is_sorted_until

Returns a ForwardIterator that is set to the last element that is in sorted order from a specified range.

The second version lets you provide a BinaryPredicate function that returns true when two given elements are in sorted order, and false otherwise.

template<class ForwardIterator>
    ForwardIterator is_sorted_until(
        ForwardIterator _First, 
        ForwardIterator _Last
    );
template<class ForwardIterator, class BinaryPredicate>
    ForwardIterator is_sorted_until(
        ForwardIterator _First, 
        ForwardIterator _Last, 
        BinaryPredicate _Comp
    );

_First

A forward iterator that indicates where the range to check starts.

_Last

A forward iterator that indicates the end of a range.

_Comp

The condition to test to determine an order between two elements. A predicate takes a single argument and returns true or false.

Returns a ForwardIterator set to the last element in sorted order. The sorted sequence starts from _First.

The first template function returns the last iterator next in [_First, _Last] so that [_First, next) is a sorted sequence ordered by operator<. If distance() < 2 the function returns _Last.

The second template function behaves the same, except that it replaces operator<(X, Y) with _Comp(X, Y).

Header: <algorithm>

Namespace: std

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft