FastLED 3.10.8
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 539 of file algorithm.h.

539 {
540 auto size = last - first;
541 if (size <= 16) { // Use insertion sort for small arrays (it's stable)
542 insertion_sort(first, last, comp);
543 return;
544 }
545
546 Iterator middle = first + size / 2;
547 mergesort_impl(first, middle, comp);
548 mergesort_impl(middle, last, comp);
549 merge_inplace(first, middle, last, comp);
550}
void mergesort_impl(Iterator first, Iterator last, Compare comp) FL_NO_EXCEPT
Definition algorithm.h:539
void insertion_sort(Iterator first, Iterator last, Compare comp) FL_NO_EXCEPT
Definition algorithm.h:303
void merge_inplace(Iterator first, Iterator middle, Iterator last, Compare comp) FL_NO_EXCEPT
Definition algorithm.h:464

References fl::FL_NO_EXCEPT, insertion_sort(), merge_inplace(), and mergesort_impl().

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

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