Skip to content

Commit c34b71c

Browse files
committed
Do not needlessly wrap code in a lambda
1 parent a695262 commit c34b71c

File tree

1 file changed

+29
-31
lines changed

1 file changed

+29
-31
lines changed

source/containers/algorithms/sort/inplace_radix_sort.cpp

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -219,41 +219,39 @@ struct UnsignedInplaceSorter {
219219
auto partitions = partition_counts(to_sort, extract_key, sort_data, offset);
220220
auto const first = containers::begin(to_sort);
221221
using difference_type = iter_difference_t<decltype(first)>;
222-
[&]{
223-
if (partitions.number > 1) {
224-
std::uint8_t * current_block_ptr = partitions.remaining.data();
225-
PartitionInfo * current_block = partitions.partitions.data() + *current_block_ptr;
226-
std::uint8_t * last_block = partitions.remaining.data() + partitions.number - 1;
227-
auto it = first;
228-
auto block_end = first + ::bounded::assume_in_range<difference_type>(current_block->next_offset);
229-
auto last_element = containers::prev(containers::end(to_sort));
230-
for (;;) {
231-
PartitionInfo * block = partitions.partitions.data() + current_byte(extract_key(*it), sort_data, offset);
232-
if (block == current_block) {
233-
++it;
234-
if (it == last_element)
235-
break;
236-
else if (it == block_end) {
237-
for (;;) {
238-
++current_block_ptr;
239-
if (current_block_ptr == last_block)
240-
return;
241-
current_block = partitions.partitions.data() + *current_block_ptr;
242-
if (current_block->offset != current_block->next_offset)
243-
break;
244-
}
245-
246-
it = first + ::bounded::assume_in_range<difference_type>(current_block->offset);
247-
block_end = first + ::bounded::assume_in_range<difference_type>(current_block->next_offset);
222+
if (partitions.number > 1) {
223+
std::uint8_t * current_block_ptr = partitions.remaining.data();
224+
PartitionInfo * current_block = partitions.partitions.data() + *current_block_ptr;
225+
std::uint8_t * last_block = partitions.remaining.data() + partitions.number - 1;
226+
auto it = first;
227+
auto block_end = first + ::bounded::assume_in_range<difference_type>(current_block->next_offset);
228+
auto last_element = containers::prev(containers::end(to_sort));
229+
for (;;) {
230+
PartitionInfo * block = partitions.partitions.data() + current_byte(extract_key(*it), sort_data, offset);
231+
if (block == current_block) {
232+
++it;
233+
if (it == last_element)
234+
break;
235+
else if (it == block_end) {
236+
for (;;) {
237+
++current_block_ptr;
238+
if (current_block_ptr == last_block)
239+
return;
240+
current_block = partitions.partitions.data() + *current_block_ptr;
241+
if (current_block->offset != current_block->next_offset)
242+
break;
248243
}
249-
} else {
250-
auto const partition_offset = ::bounded::assume_in_range<containers::index_type<View>>(block->offset++);
251-
using std::swap;
252-
swap(*it, to_sort[partition_offset]);
244+
245+
it = first + ::bounded::assume_in_range<difference_type>(current_block->offset);
246+
block_end = first + ::bounded::assume_in_range<difference_type>(current_block->next_offset);
253247
}
248+
} else {
249+
auto const partition_offset = ::bounded::assume_in_range<containers::index_type<View>>(block->offset++);
250+
using std::swap;
251+
swap(*it, to_sort[partition_offset]);
254252
}
255253
}
256-
}();
254+
}
257255
auto partition_begin = first;
258256
for (std::uint8_t * it = partitions.remaining.data(), * remaining_end = partitions.remaining.data() + partitions.number; it != remaining_end; ++it) {
259257
auto const end_offset = ::bounded::assume_in_range<difference_type>(partitions.partitions[*it].next_offset);

0 commit comments

Comments
 (0)