Multiple ChoiceBeginner 45s
Moved-from object guarantees
After `std::vector<int> b = std::move(a);` where a was non-empty, what is guaranteed about `a`?
Options
- 1It is guaranteed to be empty, because the move constructor always leaves the source cleared.
- 2It is guaranteed to retain its elements, because the move only transfers the buffer pointer.
- 3It is left in a state where any method call is undefined behavior until it is reassigned.
- 4It is in a valid but unspecified state; only operations without preconditions (like clear(), assignment) are safe.
Think you can answer under pressure?
Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.