ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> cpp-sig
cpp-sig
[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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved