[C++-sig] Enhanced shared_ptr support
by David Abrahams other posts by this author
Feb 27 2003 3:49AM messages near this date
Re: [C++-sig] extracting a c++ object from a PyObject
|
[C++-sig] Re: 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
_______________________________________________
C++-sig mailing list
C++-sig@[...].org
http://mail.python.org/mailman/listinfo/c++-sig
Thread:
David Abrahams
Brett Calcott
|