[C++-sig] problem with constructor/implicitly_convertible

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Thu Feb 3 00:04:13 CET 2005


--- Benjamin Schmeling <Benjamin_Schmeling at gmx.de> wrote:

> Now I want to have a implicit conversion from long_ to bigint. My 
> original c++ class has no constructor with long_ but my python-bigint 
> class. The compiler tries to find one on c++ bigint and doesn't find it. 
> How should I use implicitly_convertible to reach my goal?

Maybe you can do it with implicitly_convertible, but I don't know.

You can always make it work with thin wrappers for your functions taking bigint
as an argument. If there are too many of these functions (say > 10) this
approach becomes annoying. In that case I'd do it with a custom converter. See
my old message:

  http://mail.python.org/pipermail/c++-sig/2003-May/004133.html 

This code is almost 2 years old but I believe it is still compatible with the
latest Boost. The code looks very low level, but if you simply follow the
recipe it should be straightforward to adapt it to your bigint type.

Cheers,
        Ralf



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail



More information about the Cplusplus-sig mailing list