Boost logo

Boost :

Subject: Re: [boost] [move][container] Review Request (new versions of Boost.Move and Boost.Container in sandbox and vault)
From: Jeffrey Hellrung (jhellrung_at_[hidden])
Date: 2009-09-07 15:08:47


Howard Hinnant wrote:
> Using an experimental C++0x compiler and library (you might can do this
> experiment g++-4.4, I'm not sure) I make this substitution and indeed, I
> get the same output (remove all of the *.dat files prior to each run).
> This experimental library has:
>
> template <class _Tp, class _Allocator>
> inline
> vector<_Tp, _Allocator>&
> vector<_Tp, _Allocator>::operator=(vector&& __x)
> {
> clear();
> swap(__x);
> return *this;
> }
>

Perhaps a dumb question, but isn't the above incorrect under
self-assigment (x = move(x))? Is there a "standard way" or "recommended
guideline" for handling self-assignment in the move assignment operator,
or is this a nonissue?

- Jeff


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