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 534 of file algorithm.h.

534 {
535 auto size = last - first;
536 if (size <= 16) { // Use insertion sort for small arrays (it's stable)
537 insertion_sort(first, last, comp);
538 return;
539 }
540
541 Iterator middle = first + size / 2;
542 mergesort_impl(first, middle, comp);
543 mergesort_impl(middle, last, comp);
544 merge_inplace(first, middle, last, comp);
545}
void mergesort_impl(Iterator first, Iterator last, Compare comp) FL_NOEXCEPT
Definition algorithm.h:534
void merge_inplace(Iterator first, Iterator middle, Iterator last, Compare comp) FL_NOEXCEPT
Definition algorithm.h:459
void insertion_sort(Iterator first, Iterator last, Compare comp) FL_NOEXCEPT
Definition algorithm.h:298

References FL_NOEXCEPT, 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: