Boost logo

Boost :

From: Joe Gottman (jgottman_at_[hidden])
Date: 2007-04-16 19:15:50


Peter Dimov wrote:
> Ion Gaztañaga wrote:
>
>> Ok. So if such objects can't be moved, there is no problem to offer
>> reusability for other objects that can be moved ;-)
>
> Reusability was never questioned. Usability after move is the problem. The
> question is whether the user may legitimately do something with an
> moved-from object with predictable results _except_ destroying or reusing it
> via assignment or reset.
>
>

    There are many more ways to reuse an object than assignment and
reset. For instance, I would be extremely disappointed if the following
code didn't work:

vector<double> foo;
vector<double> bar = move(foo);
foo.resize(10);
for (size_t n = 0; n < 10; ++n) {
      foo[n] = n + 7;
}

Joe Gottman


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