
16 Apr
2007
16 Apr
'07
11:36 p.m.
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. :-)