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
> 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
> 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.
> anyone reads unfamiliar code that contains a scoped_ptr, he can easily
> 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()
> 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
> probably copy the current version (retaining its copyright notices, of

Maybe you want a private non-swappable version?

           David Abrahams * Boost Consulting
dave_at_[hidden] *

Boost list run by bdawes at, gregod at, cpdaniel at, john at