Boost logo

Boost Users :

From: Ian Mold (ian_at_[hidden])
Date: 2002-08-19 16:48:12


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.

// Assignment to a 'normal' pointer.
    shared_ptr & operator=(T * r)
    {
      this_type(r).swap(*this);
      return *this;
    }

I have a few questions.
1) Is this necessary?
2) Does this do the job?
3) Is there any reason this wasn't included in the first place?

I welcome any comments.

Regards,
IanM


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