Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-04-17 09:48:19


Greer, Joe wrote:

> [Joe] Tossing in my own $.02, this Joe tends to agree somewhat with
> the other Joe. :) If I wanted to swap p and q, I can do that today
> without the move.

Not in a generic way, though. Move is about performance. For some types,
swap is slower than copy. There is also the use case of

    a = f();

where you automatically get the move assignment if f() returns an rvalue,
and an ordinary copy otherwise.

> On the other hand, if I move a value from q to p, I expect
> p's contents to be gone, not to be transferred to q.

In 99.4% of the use cases for move, q is a temporary and you don't care what
it holds, since it will be destroyed anyway at the end of the expression.
Decreasing the performance for the majority to appease a minority which
would like to move from lvalues and have them in a predictable state
afterwards seems like a questionable tradeoff to me. Not necessarily wrong,
just questionable. :-)


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