[C++-sig] reference counting pointers
Dusty Leary
dleary at ttlc.net
Thu Jul 17 21:41:04 CEST 2003
Hi,
Can someone give me example of a ResultConvertorGenerator (or whatever is
required) so that addref/decref calls get called on an object?
Currently, I am using boost::intrusive_ptr, which does almost what I want.
All my class bindings are defined like so: class_<A, intrusive_ptr<A>
>("A"); class_<B, intrusive_ptr<B>, bases<A> >("B"); etc...
The problem is that functions which accept an intrusive_ptr<A>, when called
with an intrusive_ptr<B>, cause boost.python errors (no valid type found).
So, I would like to replace most of the uses of intrusive_ptr<A> with A* (in
method signatures), and just have my C++ implementations use intrusive_ptr
internally. This way, the polymorphic thing will work out ok, with boost
wrapping B* and calling foo(A*) rather than wrapping intrusive_ptr<B> and
failing to call foo(intrusive_ptr<A>).
More information about the Cplusplus-sig
mailing list