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
use
Per 25.4/5:
A sequence is sorted with respect to a comparator
comp
if for any iteratori
pointing to the sequence and any non-negative integern
such thati + n
is a valid iterator pointing to an element of the sequence,comp(*(i + n), *i) == false
.
So, for
1 2 3 3 4 5
std::less
will return false
for all n
, while std::less_equal
will return true
for case 3 3
.