4#ifndef TETL_ALGORITHM_INSERTION_SORT_HPP
5#define TETL_ALGORITHM_INSERTION_SORT_HPP
7#include <etl/_algorithm/iter_swap.hpp>
8#include <etl/_functional/less.hpp>
19template <
typename RandomIt,
typename Compare>
20constexpr auto insertion_sort(RandomIt first, RandomIt last, Compare comp) ->
void
22 for (
auto i = first; i != last; ++i) {
25 while (j != first
and comp(key, *(j - 1))) {
35template <
typename RandomIt>
constexpr auto insertion_sort(RandomIt first, RandomIt last, Compare comp) -> void
Sorts the elements in the range [first, last) in non-descending order. The order of equal elements is...
Definition insertion_sort.hpp:20
constexpr auto insertion_sort(RandomIt first, RandomIt last) -> void
Definition insertion_sort.hpp:36
Definition adjacent_find.hpp:9
Function object for performing comparisons. Unless specialised, invokes operator< on type T....
Definition less.hpp:15