Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-04-17 05:56:47


Joe Gottman wrote:

> But note that it is possible to efficiently make q hold a null pointer
> after a move assignment:
>
> shared_ptr & operator=( shared_ptr && r ) // never throws
> {
> pn.swap(r.pn);
> px = r.px;
> r.px = 0;
> return *this;
> }

Yes, I know. This still leaves r half-empty, except that now it is the other
half. If we're going to the trouble to clear r, I'd rather have it in a
completely specified state.


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