13#ifndef RANGES_V3_ALGORITHM_PARTIAL_SORT_COPY_HPP
14#define RANGES_V3_ALGORITHM_PARTIAL_SORT_COPY_HPP
30#include <range/v3/utility/static_const.hpp>
32#include <range/v3/detail/prologue.hpp>
38 RANGES_FUNC_BEGIN(partial_sort_copy)
52 constexpr O RANGES_FUNC(partial_sort_copy)(I first,
63 for(;
first != last && r != out_end; ++
first, ++r)
65 make_heap(out_begin, r, ranges::ref(pred), ranges::ref(out_proj));
66 auto len = r - out_begin;
72 *out_begin = (
decltype(x) &&)x;
73 detail::sift_down_n(out_begin,
77 ranges::ref(out_proj));
80 sort_heap(out_begin, r, ranges::ref(pred), ranges::ref(out_proj));
86 template(
typename InRng,
97 constexpr borrowed_iterator_t<OutRng> RANGES_FUNC(partial_sort_copy)(InRng && in_rng,
103 return (*
this)(begin(in_rng),
109 std::move(out_proj));
112 RANGES_FUNC_END(partial_sort_copy)
116 using ranges::partial_sort_copy;
121#include <range/v3/detail/epilogue.hpp>
The indirect_strict_weak_order concept.
The indirectly_copyable concept.
The random_access_iterator concept.
The random_access_range concept.
The sentinel_for 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
Definition identity.hpp:25
Definition comparisons.hpp:50