Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-04-16 19:36:06

Joe Gottman wrote:

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

The code will work under any implementation of the move constructor, IMO.
The more interesing question is, given:

    bar = move(foo);

would you be extremely disappointed if foo doesn't retain its allocator
instance but gets bar's after the move?

I, personally, don't intend to ever do something with a moved-from object
except destroy it. :-)

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