96 void operator()(It first, It last, Getter getter = Getter{})
const {
98 constexpr auto passes = N / Bit;
100 using value_type = stl::iterator_traits<It>::value_type;
101 using difference_type = stl::iterator_traits<It>::difference_type;
102 stl::vector<value_type> aux(
static_cast<stl::size_t
>(stl::distance(first, last)));
104 auto part = [getter = stl::move(getter)](
auto from,
auto to,
auto out,
auto start) {
105 constexpr auto mask = (1 << Bit) - 1;
106 constexpr auto buckets = 1 << Bit;
109 stl::size_t count[buckets]{};
111 for(
auto it = from; it != to; ++it) {
112 ++count[(getter(*it) >> start) & mask];
116 stl::size_t index[buckets]{};
118 for(stl::size_t pos{}, end = buckets - 1u; pos < end; ++pos) {
119 index[pos + 1u] = index[pos] + count[pos];
122 for(
auto it = from; it != to; ++it) {
123 const auto pos = index[(getter(*it) >> start) & mask]++;
124 out[
static_cast<difference_type
>(pos)] = stl::move(*it);
128 for(stl::size_t pass = 0; pass < (passes & ~1u); pass += 2) {
129 part(first, last, aux.begin(), pass * Bit);
130 part(aux.begin(), aux.end(), first, (pass + 1) * Bit);
133 if constexpr(passes & 1) {
134 part(first, last, aux.begin(), (passes - 1) * Bit);
135 stl::move(aux.begin(), aux.end(), first);