Boost logo

Boost :

Subject: Re: [boost] [shared_ptr] delete shared_ptr
From: Eric J. Holtman (eric_at_[hidden])
Date: 2011-03-18 11:00:44


On 3/18/2011 8:44 AM, Kenny Riddile wrote:

>
> 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.
>

I have to chime in and agree here.

having "delete p" do *anything other* than p = 0
for a smart pointer would be suicidal.

And *having* it just do p = 0 is asking for trouble.
People will assume (since you can't tell from context)
that it's *not* a smart pointer.


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