Boost logo

Boost :

Subject: Re: [boost] [variant] Please vote for behavior
From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2013-02-07 13:54:23

On 06.02.2013, at 22:10, Dave Abrahams wrote:

> on Sat Feb 02 2013, Sebastian Redl <> wrote:
>> Anything that gives the target object the state the source object had
>> and is cheaper than a copy is a successful move, really. That is what
>> a move ultimately is: an optimization of copying.
> I never liked that characterization. If move were an optimization of
> copy it would have all the semantics of copy...

I disagree. That would be the case if move were a universally applicable optimization, but it isn't. It's a special case optimization. In intent, it optimizes copying for the case where the resulting state of the source object is irrelevant. In practice, the source object must retain some valid state.

This is really similar to how the compiler can only apply some optimizations if it can prove certain properties of the code, e.g. that two pointers don't alias (various redundant load or store eliminations) or that a piece of code is side effect free (loop fusion, common subexpression elimination).


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