1#ifndef ENTT_CORE_ALGORITHM_HPP
2#define ENTT_CORE_ALGORITHM_HPP
35 template<
typename It,
typename Compare = std::less<>,
typename... Args>
37 std::sort(std::forward<Args>(
args)..., std::move(first), std::move(last), std::move(
compare));
54 template<
typename It,
typename Compare = std::less<>>
57 for(
auto it = first + 1;
it < last; ++
it) {
58 auto value = std::move(*
it);
63 *
pre = std::move(*(
pre - 1));
67 *
pre = std::move(value);
78template<std::
size_t Bit, std::
size_t N>
80 static_assert((
N %
Bit) == 0,
"The maximum number of bits to sort must be a multiple of the number of bits processed per pass");
97 template<
typename It,
typename Getter =
identity>
102 using value_type =
typename std::iterator_traits<It>::value_type;
103 std::vector<value_type>
aux(std::distance(first, last));
106 constexpr auto mask = (1 <<
Bit) - 1;
120 index[
pos + 1u] = index[
pos] + count[
pos];
133 if constexpr(
passes & 1) {
135 std::move(
aux.begin(),
aux.end(), first);
constexpr Type make_obj_using_allocator(const Allocator &allocator, Args &&...args)
Uses-allocator construction utility (waiting for C++20).
Function object for performing insertion sort.
void operator()(It first, It last, Compare compare=Compare{}) const
Sorts the elements in a range.
Function object for performing LSD radix sort.
void operator()(It first, It last, Getter getter=Getter{}) const
Sorts the elements in a range.
Function object to wrap std::sort in a class type.
void operator()(It first, It last, Compare compare=Compare{}, Args &&...args) const
Sorts the elements in a range.