kblib 0.2.3
General utilities library for modern C++
kblib::detail_sort Namespace Reference

Classes

struct  sort_transform_impl
 Sort data after applying an arbitrary transformation to it. The primary template handles the general case of arbitrary transformation and arbitrary compare predicate. More...
 
struct  sort_transform_impl< RandomAccessIt, UnaryOperation, BinaryPredicate, SortKey, small_size, true, false, false, false >
 Sort implementation for pointer to member object of non-fundamental type, so sort keys are constant time to extract (this is most similar to a general sort()) More...
 
struct  sort_transform_impl< RandomAccessIt, UnaryOperation, std::greater< LessT >, SortKey, small_size, M, false, true, false >
 Sort implementation for key of radix sortable type type with reverse sorting. More...
 
struct  sort_transform_impl< RandomAccessIt, UnaryOperation, std::greater< LessT >, SortKey, small_size, true, true, false, false >
 Sort implementation for pointer to member object of fundamental non-integral type with reverse sorting, so sort keys are constant time to extract and compare. More...
 
struct  sort_transform_impl< RandomAccessIt, UnaryOperation, std::greater< LessT >, SortKey, small_size, true, true, true, true >
 Sort implementation for pointer to member object of integral type with reverse sorting, so we can do radix sort. More...
 
struct  sort_transform_impl< RandomAccessIt, UnaryOperation, std::less< LessT >, SortKey, small_size, M, false, true, false >
 Sort implementation for key of radix sortable type type with default sorting. More...
 
struct  sort_transform_impl< RandomAccessIt, UnaryOperation, std::less< LessT >, SortKey, small_size, true, true, false, false >
 Sort implementation for pointer to member object of fundamental non-integral type with default sorting, so sort keys are constant time to extract and compare. More...
 
struct  sort_transform_impl< RandomAccessIt, UnaryOperation, std::less< LessT >, SortKey, small_size, true, true, true, true >
 Sort implementation for pointer to member object of integral type with default sorting, so we can do radix sort. More...
 

Enumerations

enum class  sort_direction { ascending , descending }
 

Functions

template<typename RandomAccessIt , typename Compare >
constexpr auto sort (RandomAccessIt, const RandomAccessIt, Compare) -> void
 
template<typename RandomAccessIt , typename Compare >
constexpr auto stable_sort (RandomAccessIt, const RandomAccessIt, Compare) -> void
 
template<typename RandomAccessIt , typename Compare , std::size_t small_size>
constexpr auto merge_sort (RandomAccessIt begin, const RandomAccessIt end, Compare cmp) -> void
 
template<typename RandomAccessIt , typename Compare , std::size_t small_size>
constexpr auto heap_sort (RandomAccessIt begin, const RandomAccessIt end, Compare cmp) -> void
 
template<sort_direction dir, typename RandomAccessIt , typename Projection >
constexpr auto radix_sort_i (RandomAccessIt begin, const RandomAccessIt end, Projection proj) -> void
 
template<sort_direction dir, typename RandomAccessIt , typename Projection >
constexpr auto radix_sort_s (RandomAccessIt begin, const RandomAccessIt end, Projection proj) -> void
 
template<std::size_t size>
constexpr auto make_array_for (std::false_type) -> kblib::containing_ptr< std::array< std::size_t, size > >
 
template<std::size_t size>
auto make_array_for (std::true_type) -> kblib::heap_value< std::array< std::size_t, size+1 > >
 
template<sort_direction dir, typename RandomAccessIt1 , typename RandomAccessIt2 , typename Projection >
constexpr auto counting_sort (RandomAccessIt1 begin, const RandomAccessIt1 end, RandomAccessIt2 d_begin, Projection proj) -> void
 

Enumeration Type Documentation

◆ sort_direction

Enumerator
ascending 
descending 

Definition at line 394 of file sort.h.

Function Documentation

◆ counting_sort()

template<sort_direction dir, typename RandomAccessIt1 , typename RandomAccessIt2 , typename Projection >
constexpr auto kblib::detail_sort::counting_sort ( RandomAccessIt1  begin,
const RandomAccessIt1  end,
RandomAccessIt2  d_begin,
Projection  proj 
) -> void
constexpr

Definition at line 437 of file sort.h.

◆ heap_sort()

template<typename RandomAccessIt , typename Compare , std::size_t small_size>
constexpr auto kblib::detail_sort::heap_sort ( RandomAccessIt  begin,
const RandomAccessIt  end,
Compare  cmp 
) -> void
constexpr

Definition at line 385 of file sort.h.

◆ make_array_for() [1/2]

template<std::size_t size>
constexpr auto kblib::detail_sort::make_array_for ( std::false_type  ) -> kblib::containing_ptr<std::array<std::size_t, size>>
constexpr

Definition at line 425 of file sort.h.

◆ make_array_for() [2/2]

template<std::size_t size>
auto kblib::detail_sort::make_array_for ( std::true_type  ) -> kblib::heap_value<std::array<std::size_t, size + 1>>

Definition at line 430 of file sort.h.

◆ merge_sort()

template<typename RandomAccessIt , typename Compare , std::size_t small_size>
constexpr auto kblib::detail_sort::merge_sort ( RandomAccessIt  begin,
const RandomAccessIt  end,
Compare  cmp 
) -> void
constexpr

Definition at line 370 of file sort.h.

◆ radix_sort_i()

template<sort_direction dir, typename RandomAccessIt , typename Projection >
constexpr auto kblib::detail_sort::radix_sort_i ( RandomAccessIt  begin,
const RandomAccessIt  end,
Projection  proj 
) -> void
constexpr

Definition at line 397 of file sort.h.

◆ radix_sort_s()

template<sort_direction dir, typename RandomAccessIt , typename Projection >
constexpr auto kblib::detail_sort::radix_sort_s ( RandomAccessIt  begin,
const RandomAccessIt  end,
Projection  proj 
) -> void
constexpr

Definition at line 407 of file sort.h.

◆ sort()

template<typename RandomAccessIt , typename Compare >
constexpr auto kblib::detail_sort::sort ( RandomAccessIt  ,
const  RandomAccessIt,
Compare   
) -> void
constexpr

Definition at line 364 of file sort.h.

◆ stable_sort()

template<typename RandomAccessIt , typename Compare >
constexpr auto kblib::detail_sort::stable_sort ( RandomAccessIt  ,
const  RandomAccessIt,
Compare   
) -> void
constexpr

Definition at line 366 of file sort.h.