Boost logo

Boost :

From: cppljevans_at_[hidden]
Date: 2003-10-23 08:23:57


On 10/23/2003 08:01 AM, Maxim Egorushkin wrote:
> Michael Grundberg wrote:
[snip]

> The key point is that shared_ptr<> is an exclusive owner of a raw
> pointer. No more then one shared_ptr<> should be constructed using
> the same raw pointer (unless it is 0 pointer). Violating the rule
> leads to multiple releases on the raw pointer. Using null_deleter
> allows you to remain unpunished :).

An alternative way to avoid this is to require share_ptr CTOR to take
something like auto_new<SomePolicy,SomeReferent> argument instead of
the SomeReferent* raw pointer argument. Please see:

http://groups.yahoo.com/group/boost/files/shared_cyclic_ptr/auto_new.hpp


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