| 422 | // Rotate elements in range [first, last) so that middle becomes the new first |
| 423 | template <typename Iterator> |
| 424 | void rotate_impl(Iterator first, Iterator middle, Iterator last) FL_NOEXCEPT { |
| 425 | if (first == middle || middle == last) { |
| 426 | return; |
| 427 | } |
| 428 | |
| 429 | Iterator next = middle; |
| 430 | while (first != next) { |
| 431 | swap(*first++, *next++); |
| 432 | if (next == last) { |
| 433 | next = middle; |
| 434 | } else if (first == middle) { |
| 435 | middle = next; |
| 436 | } |
| 437 | } |
| 438 | } |
| 439 | |
| 440 | // Find the position where value should be inserted in sorted range [first, last) |
| 441 | template <typename Iterator, typename T, typename Compare> |