[C++-sig] Uh-oh now I am trying boost python embedding
Stefan Seefeld
seefeld at sympatico.ca
Thu Jun 25 22:59:44 CEST 2009
On 06/25/2009 04:52 PM, Simon Pickles wrote:
>
> However, what if I want to pass a c++ type to a python class? Is there
> some way to covnert my class, Logger in this case, to an bpy object,
> or some other way?
Yes, and this conversion happens implicitly, by virtue of the converter
that has been created via class_<>.
So, the straight-forward way to do this is:
Logger *logger = ...;
bpl::object l = bpl::ptr(logger);
(the ptr() wrapper tells bpl that you want in fact pass by pointer.
Without it, bpl makes a copy.)
Regards,
Stefan
--
...ich hab' noch einen Koffer in Berlin...
More information about the Cplusplus-sig
mailing list