|
Boost : |
From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2003-01-11 23:47:59
----- Original Message -----
From: "David Abrahams" <dave_at_[hidden]>
> >> Here's an interesting turn-of-the-tables: I was experimenting with
> >> using SFINAE to disable conversion operators, and I discovered that
> >> almost every compiler except vc6/7 rejects this code:
> >>
> >> template <class T> struct voidify { typedef void type; };
> >> template <class T> struct Y {};
> >> struct X
> >> {
> >> template <class T>
> >> operator Y<T> (typename voidify<T>::type) const { return Y<T>(); }
> >> };
> >
> > Is this even legal? I.e. for a user-defined conversion operator to have
any
> > arguments at all?
>
> Look twice; the argument is void.
I know, but I don't think you can derive a 'void' parameter list that way.
E.g.
template<class> struct test; // not defined
template<class T> struct test<void (*)(T)> { }; // defined
void f(void) { }
int main() {
test< &f >(); // error
return 0;
}
In other words, the "void" parameter list is fundamentally different than
"type void".
Paul Mensonides
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk