Boost logo

Boost Users :

From: Darin Adler (darin_at_[hidden])
Date: 2002-08-19 18:11:17


On Monday, August 19, 2002, at 02:48 PM, Ian Mold wrote:

> I have been looking at the shared_ptr class, and I have made a change
> to include an assignment from a standard pointer. I have done this so
> that I don't have to create a new shared_ptr just to reassign an
> existing shared_ptr.

You can use the reset() member function to do this. You don't need to
change the class.

Using a named member function (reset) is less error prone because the
transfer of ownership is clearer; that's why we don't provide an
operator= that "adopts" the passed pointer.

     -- Darin


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