cpp/algorithm/ranges/is sorted until

Examines the range and finds the largest range beginning at  in which the elements 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 the given binary comparison function. @2@ Same as, but uses as the source range, as if using  as  and  as.

Return value
The upper bound of the largest range beginning at in which the elements are sorted in non-descending order. That is, the last iterator for which range  is sorted.

Complexity
Linear in the distance between and.