[C++-sig] expose class that does it's own ref counting

Neal Becker ndbecker2 at gmail.com
Fri Apr 27 11:35:02 CEST 2007

David Sveningsson wrote:

> Neal Becker skrev:
>> I'm interested to play with exposing blitz++ arrays.  They do there own
>> ref
>> counting.  Do I need to do anything special?  I'm thinking that I can
>> just ignore this fact, and nothing bad will happen (except maybe some
>> inefficiency).  Is this correct?
> Try using boost::intrusive_ptr as container for the classes. Worked for
> me when I did something similar. boost::intrusive_ptr requires you to
> write two additional functions, intrusive_ptr_add_ref and
> intrusive_ptr_release which takes a pointer as parameter should
> increases and decrease the refcount.

Thanks.  That sounds like good advice.  I'm still wondering, though, what
happens if I don't do anything (just expose the object as is).  I'm
thinking that it won't break anything, just result in some inefficiency.

More information about the Cplusplus-sig mailing list