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

john haddon theboyhaddon at hotmail.com
Thu Jan 17 23:41:36 CET 2008


> 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...

we had similar problems when wrapping a library where we used boost::intrusive_ptr as our
smart pointer of choice. we managed to work around most of the problems using the magic
incantations in this file :

http://cortex-vfx.googlecode.com/svn/trunk/include/IECore/bindings/IntrusivePtrPatch.h

you can see an example of how we use that in this file :

http://cortex-vfx.googlecode.com/svn/trunk/src/IECore/bindings/ObjectBinding.cpp

hopefully those might give you some clue as to how to fix your problems too...

cheers...
john

_________________________________________________________________

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20080117/1c9ff749/attachment.htm>


More information about the Cplusplus-sig mailing list