| 409 | // Quicksort implementation |
| 410 | template <typename Iterator, typename Compare> |
| 411 | void quicksort_impl(Iterator first, Iterator last, Compare comp) FL_NOEXCEPT { |
| 412 | if (last - first <= 16) { // Use insertion sort for small arrays |
| 413 | insertion_sort(first, last, comp); |
| 414 | return; |
| 415 | } |
| 416 | |
| 417 | Iterator pivot = partition(first, last, comp); |
| 418 | quicksort_impl(first, pivot, comp); |
| 419 | quicksort_impl(pivot + 1, last, comp); |
| 420 | } |
| 421 | |
| 422 | // Rotate elements in range [first, last) so that middle becomes the new first |
| 423 | template <typename Iterator> |
no test coverage detected