Boost logo

Boost :

Subject: Re: [boost] [shared_ptr] delete shared_ptr
From: Kenny Riddile (kfriddile_at_[hidden])
Date: 2011-03-18 09:44:02


On 3/18/2011 2:40 AM, Sid Sacek wrote:
>
> I think it's simply stating an intention; the intention being that the current shared pointer is no longer interesting in the shared object; who cares if the shared object gets deleted under the covers. This is the mentality that one needs to have in a garbage-collected environment, since you get the same exact effect when you set a reference to null.
>

But it doesn't state that intention at all. The intention it very
clearly states is that something *is* being deleted. The word "delete"
has a very specific meaning in the English language. Assigning the
shared_ptr to null or to another shared_ptr tracking a different object
*does* state that intention, but "delete p;" and "p = 0;" are not, and
should not, be the same.


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