Enhanced shared_ptr support
A few days ago I checked in some changes to the way shared_ptrs get converted to Python. A while back I had added a special shared_ptr deleter which caused all shared_ptr conversions from python to maintain the lifetime of the owning Python object, not of the C++ object. In other words, we'll have this: shared_ptr<T> T +------+------+ +------+ | | | | | | * | *------->| | | || | | | | +--||--+------+ +------+ || /\ \/ || +-----------------+ || | | || | Python Object *======++ | | +-----------------+ The double lines represent ownership relationships. Now, when such a shared_ptr is converted back to python, the owned Python object is returned, rather than a new Python object being built around the shared_ptr, sharing ownership of the T object with the Python object above. -Dave -- Dave Abrahams Boost Consulting www.boost-consulting.com
This is very cool. Thanks...
A few days ago I checked in some changes to the way shared_ptrs get converted to Python. A while back I had added a special shared_ptr deleter which caused all shared_ptr conversions from python to maintain the lifetime of the owning Python object, not of the C++ object. In other words, we'll have this:
shared_ptr<T> T +------+------+ +------+ | | | | | | * | *------->| | | || | | | | +--||--+------+ +------+ || /\ \/ || +-----------------+ || | | || | Python Object *======++ | | +-----------------+
The double lines represent ownership relationships. Now, when such a shared_ptr is converted back to python, the owned Python object is returned, rather than a new Python object being built around the shared_ptr, sharing ownership of the T object with the Python object above.
-Dave
-- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (2)
-
Brett Calcott -
David Abrahams