
18 Mar
2011
18 Mar
'11
3 p.m.
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.