[C++-sig] Best way to register shared_ptr<const T>
Hans Meine
meine at informatik.uni-hamburg.de
Fri Jan 25 10:03:48 CET 2008
Am Donnerstag, 24. Januar 2008 23:00:02 schrieb Alex Mohr:
> Boost.python has special-case code for shared_ptr. When boost.python
> creates a shared_ptr for a class, it supplies a special custom deleter
> that tracks the python object identified with the c++ object.
For the first time, I begin to see this clear. So.. this only works if
boost::python creates the shared_ptr? E.g. if I have a method
shared_ptr<Foo> createFoo() { ... }
Will boost::python be able to retroactively add the custom deleter? AFAICS,
this is impossible, because the shared_ptr might be actually shared, so BPL
cannot re-wrap the pointer in another shared_ptr... yes it can, if the custom
deleter stores a reference to the original shared_ptr?
Ciao, / /
/--/
/ / ANS
More information about the Cplusplus-sig
mailing list