
Nevin Liber wrote:
On 17 March 2011 13:53, pavel <paul.cpprules@gmail.com> wrote:
it deletes or otherwise releases guarded resource only if no other smart pointer holds a reference to the resource
Yes, we know what reset does. You haven't given an argument as to why delete should do the same thing, and we've given you reasons why it isn't a good idea.
+1 If you want to say that a specific smart pointer has no interest in the pointee anymore, I think the expression p = 0; covers those semantics better. I don't know whether the current Boost.Smart_Ptr implementation supports that syntax, but it might be a nice addition. (I.e., p = 0; means the same as p.reset();.) delete p; really suggests that the pointee is going to be destroyed, so if that's not what you intend you shouldn't use the syntax. -Julian