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

Jonathan Brandmeyer jbrandmeyer at earthlink.net
Thu Feb 3 05:27:30 CET 2005

On Wed, 2005-02-02 at 15:04 -0800, Ralf W. Grosse-Kunstleve wrote:
>  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

Is the construct function allowed to bomb out and
throw_error_already_set?  In particular, if I want to perform a custom
rvalue converter for a sequence of some type, I don't want to have to
iterate across the entire sequence just to perform the convertible

Is there any way to register an implicit conversion from a Python type
to a subclass, that will be invoked for functions expecting a base
class?  example:

struct Base {};
struct Derived : Base {};

void f( const Base& b);

How can I register an implicit converter for Python int -> Derived that
will be picked up when f() is called from Python?


More information about the Cplusplus-sig mailing list