← Quiz: Iterators in C++: all 10 questions
Quiz: Iterators in C++ · Question 10 of 10
Which container keeps iterators to other elements valid when you insert or erase?
Which container keeps iterators to other elements valid when you insert or erase?
- A.vector
- B.deque
- C.list
- D.string
Answer & explanation
Correct answer: list
In a list, inserting invalidates nothing and erasing invalidates only the erased element, because nodes never move.
Can you get the rest right without peeking?
Take the timed Quiz: Iterators in C++ quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →