I do not understand well the std::is_sorted
algorithm and its default behaviour. If we look to cppreference, it says that by default std::is_sorted
uses the <
operator. Instead of that, I find that using <=
would be natural. But my problem is that for the following list of numbers :
1 2 3 3 4 5
it will return true
, even if 3 < 3
should be false
. How is that possible ?
EDIT: its seems to be worse than what I thought, because passing std::less_equal<int>
will return false in that case... What is the condition applied when I pass a comparator function?