Boost logo

Boost :

From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2007-04-16 19:40:24


> 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;
> }

I don't understand why would you do anything with foo after you moved it?

If you wanted to reuse foo for some reason, you could have said:

vector<double> foo;
...
vector<double> bar;
bar.swap(foo);
foo.resize(10);
...

Emil Dotchevski


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