for (int i = 0; i < numbers.size(); i++){ if (numbers[i] == 1){ numbers.erase(numbers.begin() + i); i--; } }