[C++-sig] shared_ptr and register_ptr_to_python

Marek Denis marek at octogan.net
Mon Oct 25 11:53:24 CEST 2010


On 11.10.2010 22:01, Jim Bosch wrote:


> A couple of notes:
>
> - I have not tested this. Likely there are some typos, and possibly even
> a bit of forgotten syntax - hopefully it's easy to correct.
>
> - Note that there's no need to re-wrap the methods that B inherits from
> A, but you do have create both PyA and PyB if you want both A and B to
> be instantiable from Python (after all, getSelf() is pure virtual).
>
> - If you have a C++ function that returns an A or B instance by
> reference or pointer, this code will still work. Of course, such an
> object will have to find some other way to implement getSelf() - only
> objects instantiated in Python will actually be PyA or PyB instances.

I still don't think it solves my problem as in original case the objects 
A and B are created only under C++. I would like to pass the pointer of 
such object, insted of copying them into Queue.Queue in Python and you 
wrote that the objects (A,B) need to be instantiated under Python...This 
time it's more like bad Queue.Queue implementation, not boost.python (as 
CallPolicies don't work).
Anyway, thank you for you help, I appreciate...


-- 
pozdrawiam

Marek Denis
[marek at octogan.net]


More information about the Cplusplus-sig mailing list