[C++-sig] Custom smart pointer with same behaviour as shared_ptr

Andrea mariofutire at googlemail.com
Thu Jan 17 21:52:22 CET 2008


David Abrahams wrote:
> on Mon Apr 02 2007, "Francis Moreau" <francis_moreau-AT-hotmail.com> wrote:
> 
> 
> Please read http://www.boost.org/libs/python/doc/v2/pointee.html
> 
> However, be aware that you won't get exactly the "magic" shared_ptr
> behavior described in
> http://www.boost.org/libs/python/doc/v2/faq.html#xref unless your
> pointer has a deleter just as shared_ptr does AND you do some extra
> work to define special converters for it (and perhaps not even then; I
> haven't looked into the details).
> 
> 

Could you please explain a bit more what you mean by

1) deleter
2) which converters
3) what more is needed

I've tried to copy boost::shared_ptr and rename it, to see whether the "magic" was coming from 
boost::share_ptr, but it looks like the "magic" is inside Boost.Python.
I've tried also tr1::shared_ptr and they all fail where boost::shared_ptr succeeds.

My library is just too huge to change all smart pointers to boost::shared_ptr...

Cheers




More information about the Cplusplus-sig mailing list