Prefer remove_if to erase elements by condition.