On 10/02/2009 10:06 AM, Michele De Stefano wrote:
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 ?
Depending on how many such functions you have, you may either simply
write a wrapper function with the right signature (i.e. accepting an 'A'
and (implicitly) converting that to a 'B' when calling the actual
function), or you may write a custom from_python converter.
Regards,
Stefan
--
...ich hab' noch einen Koffer in Berlin...
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig