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,
91 requires input_range<InRng> AND random_access_range<OutRng> AND
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>
template(typename InRng, typename OutRng, typename C=less, typename PI=identity, typename PO=identity)(requires input_range< InRng > AND random_access_range< OutRng > AND indirectly_copyable< iterator_t< InRng >
This is an overloaded member function, provided for convenience. It differs from the above function o...
CPP_concept sentinel_for
\concept sentinel_for
Definition: concepts.hpp:306
CPP_concept input_iterator
\concept input_iterator
Definition: concepts.hpp:362
CPP_concept sortable
\concept sortable
Definition: concepts.hpp:865
CPP_concept indirect_strict_weak_order
\concept indirect_strict_weak_order
Definition: concepts.hpp:689
CPP_concept random_access_iterator
\concept random_access_iterator
Definition: concepts.hpp:416
CPP_concept indirectly_copyable
\concept indirectly_copyable
Definition: concepts.hpp:782
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