Boost logo

Boost Users :

From: Darin Adler (darin_at_[hidden])
Date: 2003-05-01 08:32:37


On Thursday, May 1, 2003, at 04:57 AM, Hossein Haeri wrote:

> So the true answer is not to forget to call the reset() member
> function for every shared_ptr<>, before the end of it's scope.

No, that won't do any good. When you do a reset(), the shared_ptr
relinquishes ownership of the thing it points to. If it's the sole
owner, it will destroy the object. It's simply an error to put a
pointer to a stack object inside a shared_ptr; you can't correct that
error with a reset() call.

     -- Darin


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net