Compartilhar via


is_partitioned

Returns true if all the elements in the given range that test true for a condition come before any elements that test false.

template<class InputIterator, class BinaryPredicate>
    bool is_partitioned(
        InputIterator _First, 
        InputIterator _Last,
        BinaryPredicate _Comp
    );

Parameters

  • _First
    An input iterator that indicates where a range starts to check for a condition.

  • _Last
    An input iterator that indicates the end of a range.

  • _Comp
    The condition to test for. This is provided by a user-defined predicate function object that defines the condition to be satisfied by the element being searched for. A predicate takes a single argument and returns trueor false.

Return Value

Returns true when all of the elements in the given range that test true for a condition come before any elements that test false, and otherwise returns false.

Remarks

The template function returns true only if all elements in [_First, _Last) are partitioned by _Comp; that is, all elements X in [_First, _Last) for which _Comp(X) is true occur before all elements Y for which _Comp(Y) is false.

Requirements

Header: <algorithm>

Namespace: std

See Also

Reference

is_sorted

is_sorted_until

partition_point

partition_copy

<algorithm>

Standard Template Library