Boost logo

Boost Users :

From: Richard Hadsell (hadsell_at_[hidden])
Date: 2006-08-25 13:46:55


Michael Nicolella wrote:

> Looking at boost::scoped_ptr, as I understand it it's meant to model
> sole-ownership without transfer-of-ownership semantics. If that's the
> case, what is the utility for having it support swap() operations ?
> What functionality is lost if the swap() capability is removed?
>
It allows transfer of ownership to an owner that guarantees the same
degree of safety as the original owner, and there is still only one
owner. Please, do not remove it. I use it in linked lists, where
insertion or deletion requires moving a pointer from one node to
another, with the help of a temporary scoped_ptr.

-- 
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-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net