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