Possible Duplicate:
What constitutes a valid state for a “moved from” object in C++11?
Consider something like this:
class Foo {};
std::vector<Foo> v( 5 );
Is it legal to do something like:
v.front() = std::move( v.back() );
provided that I do something like this afterwards:
v.pop_back();
More precisely I want to know what is required for an xvalue that has undergone std::move() semantics.
I know it needs to be destructible (obviously). But anything else? Suppose I would call std::vector::insert() or some other function, that may do some copying/moving of the std::move()ed value behind the scenes.
Is that still legal?
In my real case I have std::vector<std::vector<Foo>> and do stuff with that.
But I don't know if it is legal to std::move() from a std::vector that is still used by the outer std::vector.