From: Howard Hinnant (hinnant_at_[hidden])
Date: 2002-09-21 17:50:43
On Saturday, September 21, 2002, at 06:16 PM, Peter Dimov wrote:
> From: "Howard Hinnant" <hinnant_at_[hidden]>
> [snip things I mostly agree with]
>> I find myself wondering what is the niche that scoped_ptr fills better
>> than move_ptr.
> Should there be one? I haven't been around when scoped_ptr was made
> part of
> Boost but I suspect that auto_ptr's semantics were a strong
> motivation. If
> std::auto_ptr were a move_ptr, would there be boost::scoped_ptr at all?
I'm not positive.
But I think I might see a use in:
T* foo(T* x, /* ... */)
scoped_ptr<T> p(new ...);
// big, long, hairy, function
If I knew that scoped_ptr could not transfer resources, no matter what
(by design of scoped_ptr), then I might immediately have a better
understanding of how foo worked with respect to p, without having read
through the whole function. If instead a move_ptr, or other resource
transferring smart pointer is used, I've got to read through foo to
discover the true intent of this use. Is it just RAII? Or is p's
resource transferred out of the function?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk