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

◆ insertion_sort()

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

Definition at line 238 of file algorithm.h.

238 {
239 if (first == last) return;
240
241 for (Iterator i = first + 1; i != last; ++i) {
242 auto value = fl::move(*i);
243 Iterator j = i;
244
245 while (j != first && comp(value, *(j - 1))) {
246 *j = fl::move(*(j - 1));
247 --j;
248 }
249
250 *j = fl::move(value);
251 }
252}
constexpr remove_reference< T >::type && move(T &&t) noexcept
Definition move.h:27

References fl::move().

Referenced by mergesort_impl(), and quicksort_impl().

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