Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-04-17 10:56:27


Scott Maxwell wrote:
> Hi All,
>
> I have created a new shared_ptr class called shared_ptr_embedded.
> This is based on the code for intrusive_ptr but differs in one
> important
> aspect. The struct/class pointed to is required to be derived from
> shared_ptr_count. The latter class contains an 'int count_' and
> methods
> for adding and removing references. This allows you to have the count
> embedded in your primary data, rather than having a separate
> allocation for count as shared_ptr does.

This is what intrusive_ptr is for. Just define intrusive_ptr_add_ref and
intrusive_ptr_release for your count class.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk