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
7
8namespace etl {
9
12template <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
20template <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
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
Definition adjacent_find.hpp:8
Function object for performing comparisons. Unless specialised, invokes operator< on type T....
Definition less.hpp:14