Quick Q: Reusing a moved container?
▻http://isocpp.org/feeder/?FeederAction=clicked&feed=All+Posts&seed=http%3A%2F%2Fisocpp.org%2Fblog%2F2
Quick A: clear() to make sure and use it as normal.
Recently on SO:
Reusing a moved container? From section 17.3.26 of the spec “valid but unspecified state”: an object state that is not specified except that the object’s invariants are met and operations on the object behave as specified for its type [ Example: If an object x of type std::vector<int> is in a valid but unspecified state, x.empty() can be called unconditionally, and x.front() can be called only if x.empty() returns false. —end example ] Therefore, the object is live. You can perform any operation that does not require a precondition (unless you verify the precondition first). clear, for example, has no preconditions. And it will return the object to a known state. So just clear it and use (...)
#News,Articles&_Books,