3#ifndef pRC_ALGORITHMS_SORT_H
4#define pRC_ALGORITHMS_SORT_H
12 template<
class C, IsSubscriptable
T,
13 class S = ResultOf<Subscript, T &, Index>>
14 requires IsInvocable<C, S, S> && IsAssignable<S>
15 static inline constexpr void sort(C
const &compare,
T &a,
16 Size const k = T::size(),
Size const d = 0)
18 auto const insertionSort =
19 [](
auto &a,
auto const &compare,
auto const k,
auto const d)
23 auto const x = move(a[
i]);
27 if(!compare(
x, a[j - 1]))
31 a[j] = move(a[j - 1]);
39 insertionSort(a, compare, k, d);
43 if(compare(a[
i], a[k - 1]))
47 insertionSort(a, compare, k, d);
52 template<
class C = Less, IsSubscriptable
T,
53 class S = ResultOf<Subscript, T &, Index>>
54 requires IsInvocable<C, S, S> && IsAssignable<S>
55 static inline constexpr void sort(
T &a,
Size const k = T::size(),
58 return sort(C(), a, k, d);
TN::Subscripts S
Definition externs_nonTT.hpp:9
pRC::Float<> T
Definition externs_nonTT.hpp:1
int i
Definition gmock-matchers-comparisons_test.cc:603
int x
Definition gmock-matchers-containers_test.cc:376
Definition cholesky.hpp:10
Size Index
Definition basics.hpp:32
std::size_t Size
Definition basics.hpp:31
static constexpr auto swap(XA &&a, XB &&b)
Definition swap.hpp:20
static constexpr void sort(C const &compare, T &a, Size const k=T::size(), Size const d=0)
Definition sort.hpp:15