cpp/algorithm/is sorted

Checks if the elements in range are sorted in non-descending order.

A sequence is sorted with respect to a comparator if for any iterator  pointing to the sequence and any non-negative integer  such that  is a valid iterator pointing to an element of the sequence,  evaluates to.

@1@ Elements are compared using. @3@ Elements are compared using the given binary comparison function. @2,4@ Same as, but executed according to.

Return value
if the elements in the range are sorted in non-descending order.

Complexity
Linear in the distance between and.

Possible implementation
See also the implementations in libstdc++ and libc++.