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