Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-09-23 09:31:46


From: "Richard Hadsell" <hadsell_at_[hidden]>

> The 1.28.0 version of boost::scoped_ptr does exactly what I want, in
every
> respect. If you made it possible to copy or did anything else to allow
it to
> transfer ownership, it would be less useful. If you increased its size
from
> that of a single pointer, which it replaces, it would be less useful.
>
> I use it as a data member as well as a temporary variable, because a data
> member's lifetime is just as well defined as any other kind of scope.
Whenever
> anyone reads unfamiliar code that contains a scoped_ptr, he can easily
determine
> when the object it points to will be deleted, just by looking at its
scope and
> any calls to reset().

...unless you swap() it.

> I like its simple statement of ownership. Adding release() or swap()
functions
> will add to the complexity of ownership and, for me, make it less useful.

Nobody's talking about adding release(). It already has swap (surprise!)

> If scoped_ptr changes in any way except renaming its class members, I
will
> probably copy the current version (retaining its copyright notices, of
course).

Maybe you want a private non-swappable version?

-----------------------------------------------------------
           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