All challenges
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
  1. 1All iterators, pointers and references to elements are invalidated.
  2. 2Only iterators are invalidated; references remain valid.
  3. 3Nothing is invalidated because vector moves elements in place.
  4. 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.

Play this in a 3-minute battle