Boost logo

Boost :

Subject: Re: [boost] [move][container] Review Request (new versionsofBoost.Move and Boost.Container in sandbox and vault)
From: Peter Dimov (pdimov_at_[hidden])
Date: 2009-09-07 17:31:54

I wrote:

> T& operator=( T&& x )
> {
> T( move(x) ).swap( *this );
> return *this;
> }

This is the generic version, but for vector, one might also consider the
equivalent of

T& operator=( T&& x )
    T tmp( move(x) );

    swap( x );
    swap( tmp );

    return *this;

to avoid deallocating the current capacity of *this.

Boost list run by bdawes at, gregod at, cpdaniel at, john at