Boost logo

Boost :

Subject: Re: [boost] [move][container] Review Request (new versions ofBoost.Move and Boost.Container in sandbox and vault)
From: Christopher Jefferson (chris_at_[hidden])
Date: 2009-09-07 18:14:37

On 7 Sep 2009, at 23:03, David Abrahams wrote:

> on Mon Sep 07 2009, "Peter Dimov" <> wrote:
>>> Rationale:
>>> The move assignment operator should be fast enough that an extra if-
>>> test may adversely impact performance (above the noise level).
>> The problem with making it UB is that y = move(x) now needs to be
>> guarded with if( &x
>> != &y ) everywhere in client code. Sometimes the user will know
>> that x is not y, but
>> is this really the case most of the time?
> Most of the time, yeah. Definitely, in most of the generic
> algorithms.
> But I'm not sure whether it's true enough of the time. Consider our
> new
> generic std::swap:
> template <class T>
> void swap(T& x, T& y)
> {
> T z = std::move(x);
> x = std::move(y); // <== uh oh?
> y = std::move(z);
> }
> Do we think swap(x,y) is also an error when x == y?

Last time I checked (which was a couple of years ago) STLport did a
self-swap when std::reverse was given an odd-length list, and wouldn't
accept a patch to change the behaviour.


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