25 Algorithms library [algorithms]

25.7 Sorting and related operations [alg.sorting]

25.7.7 Heap operations [alg.heap.operations]

25.7.7.5 is_­heap [is.heap]

template<class RandomAccessIterator> constexpr bool is_heap(RandomAccessIterator first, RandomAccessIterator last);
Effects: Equivalent to: return is_­heap_­until(first, last) == last;
template<class ExecutionPolicy, class RandomAccessIterator> bool is_heap(ExecutionPolicy&& exec, RandomAccessIterator first, RandomAccessIterator last);
Effects: Equivalent to:
return is_heap_until(std::forward<ExecutionPolicy>(exec), first, last) == last;
template<class RandomAccessIterator, class Compare> constexpr bool is_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
Effects: Equivalent to: return is_­heap_­until(first, last, comp) == last;
template<class ExecutionPolicy, class RandomAccessIterator, class Compare> bool is_heap(ExecutionPolicy&& exec, RandomAccessIterator first, RandomAccessIterator last, Compare comp);
Effects: Equivalent to:
return is_heap_until(std::forward<ExecutionPolicy>(exec), first, last, comp) == last;
template<RandomAccessIterator I, Sentinel<I> S, class Proj = identity, IndirectStrictWeakOrder<projected<I, Proj>> Comp = ranges::less> constexpr bool ranges::is_heap(I first, S last, Comp comp = {}, Proj proj = {}); template<RandomAccessRange R, class Proj = identity, IndirectStrictWeakOrder<projected<iterator_t<R>, Proj>> Comp = ranges::less> constexpr bool ranges::is_heap(R&& r, Comp comp = {}, Proj proj = {});
Effects: Equivalent to: return ranges::is_­heap_­until(first, last, comp, proj) == last;
template<class RandomAccessIterator> constexpr RandomAccessIterator is_heap_until(RandomAccessIterator first, RandomAccessIterator last); template<class ExecutionPolicy, class RandomAccessIterator> RandomAccessIterator is_heap_until(ExecutionPolicy&& exec, RandomAccessIterator first, RandomAccessIterator last); template<class RandomAccessIterator, class Compare> constexpr RandomAccessIterator is_heap_until(RandomAccessIterator first, RandomAccessIterator last, Compare comp); template<class ExecutionPolicy, class RandomAccessIterator, class Compare> RandomAccessIterator is_heap_until(ExecutionPolicy&& exec, RandomAccessIterator first, RandomAccessIterator last, Compare comp); template<RandomAccessIterator I, Sentinel<I> S, class Proj = identity, IndirectStrictWeakOrder<projected<I, Proj>> Comp = ranges::less> constexpr I ranges::is_heap_until(I first, S last, Comp comp = {}, Proj proj = {}); template<RandomAccessRange R, class Proj = identity, IndirectStrictWeakOrder<projected<iterator_t<R>, Proj>> Comp = ranges::less> constexpr safe_iterator_t<R> ranges::is_heap_until(R&& r, Comp comp = {}, Proj proj = {});
Let comp be less{} and proj be identity{} for the overloads with no parameters by those names.
Returns: The last iterator i in [first, last] for which the range [first, i) is a heap with respect to comp and proj.
Complexity: Linear.