Say I have a std::vector<int>
with a simple operation to copy those elements which are even:
#include <vector>
int main()
{
std::vector<int> v = {1, 2, 3, 4, 5, 6};
std::vector<int> even;
std::copy_if(std::make_move_iterator(v.begin()), std::make_move_iterator(v.end()), std::back_inserter(even), [](int i){return i%2 == 0;});
return 0;
}
My question how can I combine the above with any other method to remove the elements from vector v
which was copied to vector even