#include <algorithm>
#include <iostream>
#include <vector>

int main() {
    std::vector<int> values{1, 2, 3, 4, 6};
    const auto remove_value = [](int value) { return value % 2 == 0; };
    std::cout << "before " << values.size() << '\n';
    const auto kept_end = std::remove_if(values.begin(), values.end(), remove_value);
    std::cout << "kept " << (kept_end - values.begin()) << '\n';
    for (auto position = values.begin(); position != kept_end; ++position) {
        std::cout << *position << '\n';
    }
    values.erase(kept_end, values.end());
    std::cout << "after " << values.size() << '\n';
    for (const int value : values) {
        std::cout << value << '\n';
    }
    return 0;
}
