4#ifndef TETL_ALGORITHM_EXCHANGE_SORT_HPP
5#define TETL_ALGORITHM_EXCHANGE_SORT_HPP
7#include <etl/_algorithm/iter_swap.hpp>
8#include <etl/_functional/less.hpp>
9#include <etl/_iterator/next.hpp>
10#include <etl/_iterator/prev.hpp>
18template <
typename RandomIt,
typename Compare>
19constexpr auto exchange_sort(RandomIt first, RandomIt last, Compare comp) ->
void
21 for (
auto i = first; i <
etl::prev(last); ++i) {
22 for (
auto j =
etl::next(i); j < last; ++j) {
34template <
typename RandomIt>
constexpr auto exchange_sort(RandomIt first, RandomIt last, Compare comp) -> void
Sorts the elements in the range [first, last) in non-descending order.
Definition exchange_sort.hpp:19
constexpr auto exchange_sort(RandomIt first, RandomIt last) -> void
Sorts the elements in the range [first, last) in non-descending order.
Definition exchange_sort.hpp:35
Definition adjacent_find.hpp:9
Function object for performing comparisons. Unless specialised, invokes operator< on type T....
Definition less.hpp:15