Multiple ChoiceBeginner 45s
vector reallocation invalidates iterators
After `v.push_back(x)` that causes `std::vector` to reallocate, what happens to previously held iterators and references?
Options
- 1All iterators, pointers and references to elements are invalidated.
- 2Only iterators are invalidated; references remain valid.
- 3Nothing is invalidated because vector moves elements in place.
- 4Only the end() iterator is invalidated.
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.