3#ifndef TETL_ALGORITHM_GNOME_SORT_HPP
4#define TETL_ALGORITHM_GNOME_SORT_HPP
16template <
typename B
idirIt,
typename Compare>
17constexpr auto gnome_sort(BidirIt first, BidirIt last, Compare comp) ->
void
21 if (i == first or not comp(*i, *
etl::prev(i))) {
34template <
typename B
idirIt>
35constexpr auto gnome_sort(BidirIt first, BidirIt last) ->
void
constexpr auto iter_swap(ForwardIt1 a, ForwardIt2 b) -> void
Swaps the values of the elements the given iterators are pointing to.
Definition iter_swap.hpp:19
constexpr auto gnome_sort(BidirIt first, BidirIt last, Compare comp) -> void
Sorts the elements in the range [first, last) in non-descending order.
Definition gnome_sort.hpp:17
constexpr auto prev(BidirIt it, typename iterator_traits< BidirIt >::difference_type n=1) -> BidirIt
Return the nth predecessor of iterator it.
Definition prev.hpp:14
Definition adjacent_find.hpp:8
Function object for performing comparisons. Unless specialised, invokes operator< on type T....
Definition less.hpp:14