Boost logo

Boost :

From: Richard Hadsell (hadsell_at_[hidden])
Date: 2002-09-23 09:38:58


David Abrahams wrote:
>
> The more I think about scoped_ptr the harder it gets to justify using it.
> ...

I was not able to absorb all the details of the discussion this weekend, so I'm
not at all sure whether you have changed your mind about this. I just want to
express an opinion as a scoped_ptr user.

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().

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.

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

-- 
Dick Hadsell			914-259-6320  Fax: 914-259-6499
Reply-to:			hadsell_at_[hidden]
Blue Sky Studios                http://www.blueskystudios.com
44 South Broadway, White Plains, NY 10601

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