Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2007-07-29 11:24:34


on Sun Jul 29 2007, <XHChen-AT-winbond.com> wrote:

> Hi All,
>
> I studied the shared_ptr in the recent few days,
> and found that it uses a global reference count to determine
> when to delete the real pointer. The reference count is
> created by operator new.
> It is possible to remove the new operation by replacing
> the reference count with a linked list structure. All shared_ptr
> on the same real pointer should be linked in one list. Thus
> the length of the link list is actually the reference count.
> If a shared_ptr is destructed, it removes itself from the
> link list. And then if no other shared_ptr on the link list, it delete
> the real pointer.

Have you read http://www.boost.org/libs/smart_ptr/shared_ptr.htm#FAQ ?

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com
The Astoria Seminar ==> http://www.astoriaseminar.com

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