12 struct PopHeapFunction {
13 template<concepts::RandomAccessIterator It, concepts::SentinelFor<It> Sent,
typename Comp = function::Compare,
14 typename Proj = function::Identity>
15 requires(concepts::Sortable<It, Comp, Proj>)
16 constexpr auto operator()(It
first, Sent
last, Comp comp = {}, Proj
proj = {})
const -> It {
21 template<concepts::RandomAccessContainer Con,
typename Comp = function::Compare,
22 typename Proj = function::Identity>
23 requires(concepts::Sortable<meta::ContainerIterator<Con>, Comp, Proj>)
24 constexpr auto operator()(Con&& container, Comp comp = {}, Proj
proj = {})
const
30 friend struct MakeHeapFunction;
32 constexpr static void bubble_down(
auto first,
auto comp,
auto proj,
auto size,
decltype(
size) index) {
33 using IndexType =
decltype(
size);
35 auto child_indices = [&](
auto index) -> Tuple<Optional<IndexType>, Optional<IndexType>> {
36 auto left_index = 2 * (index + 1) - 1;
37 auto right_index = 2 * (index + 1);
39 auto maybe_index = [&](IndexType index) -> Optional<IndexType> {
45 return { maybe_index(left_index), maybe_index(right_index) };
49 auto [left_child, right_child] = child_indices(index);
70 index = largest_child;
74 constexpr static auto impl(
auto first,
auto comp,
auto proj,
auto size) {
83constexpr inline auto pop_heap = detail::PopHeapFunction {};
constexpr auto last(concepts::detail::ConstantVector auto &vector, size_t count)
Definition vector_last.h:13
constexpr auto first(concepts::detail::ConstantVector auto &vector, size_t count)
Definition vector_first.h:13
constexpr auto distance
Definition distance.h:44
constexpr auto size
Definition size.h:62
constexpr auto iterator_swap
Definition iterator_swap.h:49
constexpr auto pop_heap
Definition pop_heap.h:83
constexpr auto begin
Definition begin.h:52
constexpr auto invoke
Definition invoke.h:100
constexpr auto ref
Definition reference_wrapper.h:98
Definition any_storable.h:9
constexpr auto nullopt
Definition nullopt.h:15
constexpr auto proj
Definition proj.h:59