libhatchet
Loading...
Searching...
No Matches
hxsort.hpp File Reference

Go to the source code of this file.

Functions

template<hxrandom_iterator_concept_ iterator_t_, typename less_t_>
HX_NS_BEGIN_ constexpr void hxinsertion_sort (iterator_t_ begin_, iterator_t_ end_, const less_t_ &less_)
template<hxsorted_iterator_concept_ iterator_t_>
constexpr void hxinsertion_sort (iterator_t_ begin_, iterator_t_ end_)
template<hxrandom_iterator_concept_ iterator_t_, typename less_t_>
constexpr void hxheapsort (iterator_t_ begin_, iterator_t_ end_, const less_t_ &less_)
template<hxsorted_iterator_concept_ iterator_t_>
constexpr void hxheapsort (iterator_t_ begin_, iterator_t_ end_)
template<hxrandom_iterator_concept_ iterator_t_, typename less_t_>
constexpr void hxsort (iterator_t_ begin_, iterator_t_ end_, const less_t_ &less_)
template<hxsorted_iterator_concept_ iterator_t_>
constexpr void hxsort (iterator_t_ begin_, iterator_t_ end_)

Detailed Description

Standard sorting utilities.

For scalar key sorting see hxradix_sort.hpp. Includes support for callables when defining custom key operations. Otherwise T::operator<(const T&) and T::operator==(const T&) are used. The other relational operators are not used.

Function Documentation

◆ hxheapsort() [1/2]

template<hxsorted_iterator_concept_ iterator_t_>
void hxheapsort ( iterator_t_ begin_,
iterator_t_ end_ )
inlineconstexpr

hxheapsort (specialization) - An overload of hxheapsort over the range [begin, end) that uses hxkey_less.

Requires a random-iterator.

◆ hxheapsort() [2/2]

template<hxrandom_iterator_concept_ iterator_t_, typename less_t_>
void hxheapsort ( iterator_t_ begin_,
iterator_t_ end_,
const less_t_ & less_ )
inlineconstexpr

hxheapsort - Sorts the elements in the range [begin, end) using the heapsort algorithm.

The less callable defines the less-than ordering relationship. Requires a random-iterator.

◆ hxinsertion_sort() [1/2]

template<hxsorted_iterator_concept_ iterator_t_>
void hxinsertion_sort ( iterator_t_ begin_,
iterator_t_ end_ )
inlineconstexpr

hxinsertion_sort (specialization) - An overload of hxinsertion_sort over the range [begin, end) that uses hxkey_less.

Requires a random-iterator.

◆ hxinsertion_sort() [2/2]

template<hxrandom_iterator_concept_ iterator_t_, typename less_t_>
HX_NS_BEGIN_ constexpr void hxinsertion_sort ( iterator_t_ begin_,
iterator_t_ end_,
const less_t_ & less_ )
inlineconstexpr

hxinsertion_sort - Sorts the elements in the range [begin, end) in comparison order using the insertion sort algorithm.

The end parameter points just past the end of the array. Exception handling during operation is undefined. Declare your copy constructor and assignment operator noexcept or turn off exceptions. All of T::T(&&), T::~T() and T::operator=(T&&) are used. The less callable defines the less-than ordering relationship. Requires a random-iterator.

◆ hxsort() [1/2]

template<hxsorted_iterator_concept_ iterator_t_>
void hxsort ( iterator_t_ begin_,
iterator_t_ end_ )
inlineconstexpr

◆ hxsort() [2/2]

template<hxrandom_iterator_concept_ iterator_t_, typename less_t_>
void hxsort ( iterator_t_ begin_,
iterator_t_ end_,
const less_t_ & less_ )
inlineconstexpr

hxsort - A general purpose sort routine using T::T(&&), T::~T(), T::operator=(&&), the hxswap overloads and a less callable which defaults to hxkey_less.

Sorts the range [begin, end). This version is intended for sorting large numbers of small objects. Requires a random-iterator.