[C++-sig] how to handle bare references with a shared_ptrHeldType

David Abrahams dave at boost-consulting.com
Mon Sep 26 22:14:32 CEST 2005


"Gregory Price" <price at ELLINGTON.com> writes:

> Here I use return_internal_reference on make_A;
> so I should get a Python object "a" holding the C++ A
> as a raw pointer.  But there's no trouble passing "a"
> to get_x, which wants a shared_ptr<A>.
> What is Boost.Python doing that makes this work?

It creates a shared_ptr whose custom deleter decrements the refcount
on the Python object owning the A.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com




More information about the Cplusplus-sig mailing list