| 296 | // Insertion sort implementation for small arrays |
| 297 | template <typename Iterator, typename Compare> |
| 298 | void insertion_sort(Iterator first, Iterator last, Compare comp) FL_NOEXCEPT { |
| 299 | if (first == last) return; |
| 300 | |
| 301 | for (Iterator i = first + 1; i != last; ++i) { |
| 302 | auto value = fl::move(*i); |
| 303 | Iterator j = i; |
| 304 | |
| 305 | while (j != first && comp(value, *(j - 1))) { |
| 306 | *j = fl::move(*(j - 1)); |
| 307 | --j; |
| 308 | } |
| 309 | |
| 310 | *j = fl::move(value); |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | // Median-of-three pivot selection |
| 315 | template <typename Iterator, typename Compare> |
no outgoing calls
no test coverage detected