Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-09-17 08:34:22


From: "David Abrahams" <dave_at_[hidden]>
> - The FAQ for scoped_ptr is a little odd: signaling intent and
transferring
> ownership are orthogonal. You can use std::auto_ptr<> to signal the intent
> to transfer ownership, after all. Maybe it should say: "When reading
source
> code, it is valuable to be able to draw conclusions about program behavior
> 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
its
> 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 never
bought the "signal intent", "no ownership transfer", "bool vs int" argument.
If I want to limit an object to a given scope, I can use a simple variable.
This is, in part, why I've been reluctant to touch scoped_ptr's
documentation.

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.


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