[C++-sig] V2: conversions through constructors?
David Abrahams
david.abrahams at rcn.com
Fri Apr 5 18:48:55 CEST 2002
----- Original Message -----
From: "Peter Bienstman" <pbienst at MIT.EDU>
> Hi,
>
> I know V2 supports the implicitly_convertible() construct for the case
> of implicitly defined conversion operators, but is there something
> similar for the case of a constructor A(B), rather than a conversion
> operator B->A?
>
> Just wrapping the constructor doesn't seem to do the trick...
You use the same mechanism:
implicitly_convertible<B,A>();
see libs/python/test/implicit.*. It shows implicit conversion from
int->X.
>>> x_value(42)
42
-Dave
More information about the Cplusplus-sig
mailing list