Question 6
Back to Exercise
After std::remove(v.begin(), v.end(), 0), why is v.size() unchanged?
- A remove is broken
- B Algorithms work through iterators and cannot change a container's size; call v.erase(result, v.end()) Correct
- C remove only works on lists
- D It removes nothing
Correct Answer: Option B
C++20 std::erase(v, 0) does both steps.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!