
17 Apr
2007
17 Apr
'07
9:56 a.m.
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.