[C++-sig] Re: Enhanced shared_ptr support
Brett Calcott
brett.calcott at paradise.net.nz
Sun Mar 2 12:24:03 CET 2003
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
More information about the Cplusplus-sig
mailing list