3#ifndef TETL_ALGORITHM_MINMAX_ELEMENT_HPP
4#define TETL_ALGORITHM_MINMAX_ELEMENT_HPP
14template <
typename ForwardIt,
typename Compare>
20 if (first == last or ++first == last) {
24 if (comp(*first, *
min)) {
30 while (++first != last) {
32 if (++first == last) {
35 }
else if (not comp(*i, *
max)) {
41 if (comp(*first, *i)) {
42 if (comp(*first, *
min)) {
45 if (not comp(*i, *
max)) {
52 if (not comp(*first, *
max)) {
63template <
typename ForwardIt>
constexpr auto min(Type const &a, Type const &b, Compare comp) noexcept -> Type const &
Returns the smaller of a and b, using a compare function.
Definition min.hpp:13
constexpr auto minmax_element(ForwardIt first, ForwardIt last, Compare comp) -> pair< ForwardIt, ForwardIt >
Finds the smallest and greatest element in the range [first, last).
Definition minmax_element.hpp:15
constexpr auto max(Type const &a, Type const &b, Compare comp) noexcept -> Type const &
Returns the greater of a and b, using a compare function.
Definition max.hpp:13
Definition adjacent_find.hpp:8
Function object for performing comparisons. Unless specialised, invokes operator< on type T....
Definition less.hpp:14
etl::pair is a class template that provides a way to store two heterogeneous objects as a single unit...
Definition pair.hpp:36