I have some vectors like this:
vector<int> vec {3;0;1;0;5};
vector<int> vec1{3;2;1;7;5};
I want to sort them in ascending order but, if they contain any elements that are zero, the must be moved to the end of the vector.
My desired result is:
vector<int> vec {1;3;5;0;0};
vector<int> vec1 {1;2;3;5;7};
I used the following code; however, the order of elements is unchanged:
std::sort(vec.begin(), vec.end(), [](int a, int b)
{
return a < b && a>0;;
});
How can I fix this?