[C++-sig] Raw pointer wrapper

Paul Guse paul at mustagh.com
Thu Jan 25 19:33:11 CET 2007


Hello.
I have a reference counted c++ class that I expose to python using boost. I would like to keep the reference counting managed on the c++ side of things and just wrap the raw pointer in a boost::python::object.
Since I increment the reference count upon retrieval, I would like to decrement the count when the python object is destroyed. 
Is there a way to use boost to wrap this c++ class so that it acts like a boost python object, but has it's reference count decremented when the object goes out of scope?

In other words I need a class that can act like a python object, store a raw pointer, and decrement on destruction.
Any thoughts would be greatly appreciated. Thanks!
Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20070125/1ac372ee/attachment.htm>


More information about the Cplusplus-sig mailing list