From: David Abrahams (dave_at_[hidden])
Date: 2002-09-17 10:49:28
From: "Peter Dimov" <pdimov_at_[hidden]>
> From: "David Abrahams" <dave_at_[hidden]>
> > - The FAQ for scoped_ptr is a little odd: signaling intent and
> > ownership are orthogonal. You can use std::auto_ptr<> to signal the
> > to transfer ownership, after all. Maybe it should say: "When reading
> > code, it is valuable to be able to draw conclusions about program
> > based on the types being used. If scoped_ptr had a release() member, it
> > would become possible to transfer ownership out of its scope, weakening
> > role as a way of limiting resource lifetime to a given scope. Use
> > std::auto_ptr<> where transfer-of-ownership is required"
> I'm going to adopt your wording as-is, but I have to admit that I've
> bought the "signal intent", "no ownership transfer", "bool vs int"
Me neither. That's part of why I rewrote it. Maybe we should say:
"If scoped_ptr had a release() member, it would become possible to transfer
ownership of the held pointer, weakening its role as a way of limiting
resource lifetime to a given context"
> If I want to limit an object to a given scope, I can use a simple
> This is, in part, why I've been reluctant to touch scoped_ptr's
> Contrary to the original scoped_ptr intent, I've found it most useful in
> non-scoped scenarios: as a class member, or as a global variable.
I think "as a class member" was considered to be a scoped use - within the
scope of a class instance. I know, it's a little weak, but that's the way I
David Abrahams * Boost Consulting
dave_at_[hidden] * http://www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk