FastLED 3.9.15
Loading...
Searching...
No Matches

◆ mergesort_impl()

template<typename Iterator, typename Compare>
void fl::detail::mergesort_impl ( Iterator first,
Iterator last,
Compare comp )

Definition at line 474 of file algorithm.h.

474 {
475 auto size = last - first;
476 if (size <= 16) { // Use insertion sort for small arrays (it's stable)
477 insertion_sort(first, last, comp);
478 return;
479 }
480
481 Iterator middle = first + size / 2;
482 mergesort_impl(first, middle, comp);
483 mergesort_impl(middle, last, comp);
484 merge_inplace(first, middle, last, comp);
485}
void merge_inplace(Iterator first, Iterator middle, Iterator last, Compare comp)
Definition algorithm.h:399
void insertion_sort(Iterator first, Iterator last, Compare comp)
Definition algorithm.h:238
void mergesort_impl(Iterator first, Iterator last, Compare comp)
Definition algorithm.h:474

References insertion_sort(), merge_inplace(), and mergesort_impl().

Referenced by mergesort_impl(), and fl::stable_sort().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: