Condividi tramite


is_heap_until

Returns true if the specified range forms a heap until the last element.

template<class RandomAccessIterator>
    bool is_heap_until(
        RandomAccessIterator _First, 
        RandomAccessIterator _Last
);
template<class RandomAccessIterator, class BinaryPredicate> 
    bool is_heap_until(
        RandomAccessIterator _First, 
        RandomAccessIterator _Last, 
        BinaryPredicate _Comp
);

Parameters

  • _First
    A random access iterator that indicates the start of a range to check for a heap.

  • _Last
    A random access 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 true or false.

Return Value

Returns true if the specified range forms a heap until the last element, false if it doesn't.

Remarks

The first template function returns the last iterator next in [_First, _Last) such that [_First, next) is a heap ordered by operator< or by _Comp. If _Last - _First < 2, then 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_heap

<algorithm>

Standard Template Library

Other Resources

<algorithm> Members