Multiple ChoiceIntermediate 45s
Iterator invalidation after unordered_map insert
In std::unordered_map, what happens to references and pointers to elements when a rehash occurs due to insertion?
Options
- 1All references, pointers, and iterators to elements are invalidated by the rehash that occurs
- 2References and pointers to elements remain valid; only iterators are invalidated
- 3Nothing at all is invalidated, including iterators, which remain valid across the rehash
- 4Only references to the particular key that was erased are invalidated; everything else stays valid
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.