Bug report: 'sometimes the filter doesn't remove everything'. Sometimes! QA is furious, the developer is on vacation, and the code has a loop calling erase and then marching on with an invalidated iterator. Works on scattered data, fails on adjacent duplicates. erase returns the next iterator for a reason: take it.
removeEvens calls v.erase(it) and keeps using it — but erase invalidates the iterator. Using it afterwards is undefined behaviour, and even when it "works", adjacent matches get skipped. Use the iterator that erase returns.
erase (or restructure with the erase-remove idiom)vector::erase invalidate?Move the increment inside the loop: if (even) it = v.erase(it); else ++it; — and drop ++it from the for-header.
Hit Submit (or ⌘/Ctrl + ↵) — test results will show up here.