다음을 통해 공유


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
    );

Parameters

  • _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.

Return Value

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

Remarks

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).

Requirements

Header: <algorithm>

Namespace: std

See Also

Reference

is_sorted

<algorithm>

Standard Template Library

Other Resources

<algorithm> Members