4#ifndef TETL_ALGORITHM_MAX_ELEMENT_HPP
5#define TETL_ALGORITHM_MAX_ELEMENT_HPP
7#include <etl/_functional/less.hpp>
14template <
typename ForwardIt,
typename Compare>
15[[nodiscard]]
constexpr auto max_element(ForwardIt first, ForwardIt last, Compare comp) -> ForwardIt
21 ForwardIt largest = first;
23 for (; first != last; ++first) {
24 if (comp(*largest, *first)) {
34template <
typename ForwardIt>
35[[nodiscard]]
constexpr auto max_element(ForwardIt first, ForwardIt last)
noexcept -> ForwardIt
37 return etl::max_element(first, last,
etl::
less());
constexpr auto max_element(ForwardIt first, ForwardIt last) noexcept -> ForwardIt
Finds the greatest element in the range [first, last). Elements are compared using operator<.
Definition max_element.hpp:35
constexpr auto max_element(ForwardIt first, ForwardIt last, Compare comp) -> ForwardIt
Finds the greatest element in the range [first, last). Elements are compared using the given binary c...
Definition max_element.hpp:15
Definition adjacent_find.hpp:9
Function object for performing comparisons. Unless specialised, invokes operator< on type T....
Definition less.hpp:15