[C++-sig] Conversion from Python to C++

Michele De Stefano micdestefano at gmail.com
Fri Oct 2 16:06:57 CEST 2009


Hello to everybody.

I was wondering if there is a general way to convert a C++ class
wrapped in Python into a C++ class not wrapped in Python.
I've not fully understood the documentation on this point.

For example, assume we have two C++ classes, A and B. A is exported to
Python with class_<>, while B is not exported to Python.
Assume also that, in C++, A is convertible to B (i.e. I can construct
a B object from an existing A object).

Assume I have a C++ function (f) which takes a B object as input and I
want to expose this function, but I don't want to expose the B class.

Is there a general way to create a converter from A to B in order to
be able to call f(A) from Python ?

Thank you in advance.

-- 
Michele De Stefano


More information about the Cplusplus-sig mailing list