13#ifndef RANGES_V3_ALGORITHM_PARTIAL_SORT_HPP
14#define RANGES_V3_ALGORITHM_PARTIAL_SORT_HPP
30#include <range/v3/utility/static_const.hpp>
32#include <range/v3/detail/prologue.hpp>
38 RANGES_FUNC_BEGIN(partial_sort)
41 template(
typename I,
typename S,
typename C =
less,
typename P = identity)(
42 requires sortable<I, C, P> AND random_access_iterator<I> AND
44 constexpr I RANGES_FUNC(partial_sort)(
45 I
first, I middle, S last, C pred = C{}, P proj = P{})
47 make_heap(first, middle, ranges::ref(pred), ranges::ref(proj));
48 auto const len = middle -
first;
56 first, len, first, ranges::ref(pred), ranges::ref(proj));
59 sort_heap(first, middle, ranges::ref(pred), ranges::ref(proj));
66 constexpr borrowed_iterator_t<Rng> RANGES_FUNC(partial_sort)(
69 return (*
this)(begin(rng),
76 RANGES_FUNC_END(partial_sort)
80 using ranges::partial_sort;
85#include <range/v3/detail/epilogue.hpp>
The random_access_range concept.
decltype(begin(declval(Rng &))) iterator_t
Definition access.hpp:698
typename Fn::template invoke< Args... > invoke
Evaluate the invocable Fn with the arguments Args.
Definition meta.hpp:541
front< Pair > first
Retrieve the first element of the pair Pair.
Definition meta.hpp:2251
bool_<(T::type::value< U::type::value)> less
A Boolean integral constant wrapper around true if T::type::value is less than U::type::value; false,...
Definition meta.hpp:255
Definition identity.hpp:25
Definition comparisons.hpp:50