You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
586 B
22 lines
586 B
#pragma once
|
|
|
|
#include "counting_sort.hpp"
|
|
|
|
#include <cstddef>
|
|
#include <type_traits>
|
|
#include <utility>
|
|
|
|
namespace detail
|
|
{
|
|
template <typename Radix>
|
|
auto nth_radix(std::size_t radix_number, Radix radix)
|
|
{
|
|
return [radix_number, radix = std::move(radix)](auto n) {
|
|
using value_type = decltype(n);
|
|
static_assert(std::is_integral_v<value_type> && std::is_unsigned_v<value_type>, "");
|
|
using traits = counting_sort_traits<value_type, Radix>;
|
|
|
|
return radix(static_cast<value_type>(n >> (traits::radix_size * radix_number)));
|
|
};
|
|
}
|
|
} // namespace detail
|