
Peter Dimov wrote:
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?
No, but I would expect foo.get_allocator() to return some valid allocator and not cause a segmentation fault. In general, I don't want functions that previously were always safe to be unsafe after a move. Joe Gottman