An intern's PR landed in your review queue: removing vector elements with erase inside an index loop. It works on his laptop with five elements, therefore 'tested'. You commented 'look up erase-remove'; he reacted 👍 and changed nothing. Show him how it's done: one line instead of a quadratic loop.
Remove every occurrence of a value from a std::vector<int> in place, using the erase-remove idiom — not a hand-written shifting loop. The relative order of the remaining elements must be preserved.
std::remove (or std::remove_if) together with vector::erasestd::remove not actually change the container's size?std::remove mark?One line: v.erase(std::remove(v.begin(), v.end(), value), v.end());
Hit Submit (or ⌘/Ctrl + ↵) — test results will show up here.