I want to remove all element that are greater than 4 and this program prints : 4 3 1 8 1 and is not correct
std::vector<int> arr1 = { 4, 6, 3, 8, 1 };
std::remove_if(arr1.begin(), arr1.end(), [](int i) {return i>4; });
print(arr1);
What am i doing wrong?