Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-09-09 10:13:55


From: "Thomas Witt" <witt_at_[hidden]>

> ptr != p should be a precondition violation.

I agree (which is why shared_ptr's reset acts the way it does now), but...

> I can't think of a good reason
> why a scoped_ptr should be reset with a pointer that is already taken care
of
> by a scoped ptr.

... the reason for the current behavior is std::auto_ptr compatibility.
auto_ptr::reset is required to check for self-resets.

> The current code fails if the dtor is called during a call to reset. Yes,
> things like this can happen. The managed ptr will be deleted twice.

If you can demonstrate this with an example, you may be able to convince
Beman and Greg that scoped_ptr doesn't need to check for self-resets. :-)


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