| 396 | |
| 397 | template <typename Iterator, typename Compare> |
| 398 | void heap_sort(Iterator first, Iterator last, Compare comp) FL_NOEXCEPT { |
| 399 | heapify(first, last, comp); |
| 400 | |
| 401 | Iterator end = last - 1; |
| 402 | while (end > first) { |
| 403 | swap(*end, *first); |
| 404 | sift_down(first, first, end - 1, comp); |
| 405 | --end; |
| 406 | } |
| 407 | } |
| 408 | |
| 409 | // Quicksort implementation |
| 410 | template <typename Iterator, typename Compare> |