tetl
0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
max.hpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: BSL-1.0
2
3
#ifndef TETL_ALGORITHM_MAX_HPP
4
#define TETL_ALGORITHM_MAX_HPP
5
6
#include <
etl/_functional/less.hpp
>
7
8
namespace
etl
{
9
12
template
<
typename
Type,
typename
Compare>
13
[[nodiscard]]
constexpr
auto
max
(Type
const
& a, Type
const
& b, Compare comp)
noexcept
-> Type
const
&
14
{
15
return
comp(a, b) ? b : a;
16
}
17
20
template
<
typename
Type>
21
[[nodiscard]]
constexpr
auto
max
(Type
const
& a, Type
const
& b)
noexcept
-> Type
const
&
22
{
23
return
etl::max
(a, b,
etl::less
());
24
}
25
26
}
// namespace etl
27
28
#endif
// TETL_ALGORITHM_MAX_HPP
etl::max
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
less.hpp
etl
Definition
adjacent_find.hpp:8
etl::less
Function object for performing comparisons. Unless specialised, invokes operator< on type T....
Definition
less.hpp:14
include
etl
_algorithm
max.hpp
Generated on Sat Mar 8 2025 16:19:59 for tetl by
1.14.0