MCPcopy Create free account
hub / github.com/FastLED/FastLED / insertion_sort

Function insertion_sort

src/fl/stl/algorithm.h:298–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296// Insertion sort implementation for small arrays
297template <typename Iterator, typename Compare>
298void insertion_sort(Iterator first, Iterator last, Compare comp) FL_NOEXCEPT {
299 if (first == last) return;
300
301 for (Iterator i = first + 1; i != last; ++i) {
302 auto value = fl::move(*i);
303 Iterator j = i;
304
305 while (j != first && comp(value, *(j - 1))) {
306 *j = fl::move(*(j - 1));
307 --j;
308 }
309
310 *j = fl::move(value);
311 }
312}
313
314// Median-of-three pivot selection
315template <typename Iterator, typename Compare>

Callers 3

quicksort_implFunction · 0.85
mergesort_implFunction · 0.85
sort_smallFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected