[Date Prev][Date Next][Thread Prev][Thread Next][Author Index][Date Index][Thread Index]
More problems with SPTR
- To: <eric@son-of-blob>
- Subject: More problems with SPTR
- From: Mark S. Miller <mark@xxxxxxxxxxx>
- Date: Mon, 6 Nov 89 18:59:50 PST
- Cc: <xtech@son-of-blob>
- In-reply-to: <eric@son-of-blob'smessageofMon>,16 PST <8911070138.AA00458@xxxxxxxxxxxxxxxxxxxxxxx>
Abstract: fallback position for initialized default SPTR arguments
Date: Mon, 6 Nov 89 17:38:16 PST
From: eric@son-of-blob
extern TEMPLATE OF(class M) Accumulation OF2(Set OF(M), Set OF(M)) *
unionRecruiter (SPTR(Set) OF(M) seed = NULL);
generates the error
not implemented: constructor needed for argument initializer
The manual only says
"The default argument is a constructor or is an expression that invokes a
constructor."
The way that I (unfortunately) read this is that we can't have default
arguments where the argument must be a strong pointer in C++2.0.
Any suggestions?
I just realized what the fallback position is if we can't figure this
one out. It's to use overloading to simulate initialized default
arguments:
inline TEMPLATE OF(class M) Accumulation OF2(Set OF(M), Set OF(M)) *
unionRecruiter ()
{
return unionRecruiter (NULL);
}
extern TEMPLATE OF(class M) Accumulation OF2(Set OF(M), Set OF(M)) *
unionRecruiter (SPTR(Set) OF(M) seed);
In a peculiar way, this is not surprising, as default arguments can
just be seen as syntactic sugar for the above overloading pattern.
However, this piece of sugar really has been quite sweet. Losing
this will make the code much uglier, so please, someone out there,
please think of something.
At least it isn't a show stopper :-|