Arduino Helpers
master
Utility library for Arduino
src
AH
Math
MinMaxFix.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
AH/Math/FixArduinoMacros.hpp
>
4
5
#include <
AH/Settings/NamespaceSettings.hpp
>
6
7
BEGIN_AH_NAMESPACE
8
11
template
<
class
T,
class
U>
12
constexpr
auto
min
(
const
T &a,
const
U &b) ->
decltype
(b < a ? b : a) {
13
return
b < a ? b : a;
14
}
15
18
template
<
class
T,
class
U>
19
constexpr
auto
max
(
const
T &a,
const
U &b) ->
decltype
(a < b ? b : a) {
20
return
a < b ? b : a;
21
}
22
23
END_AH_NAMESPACE
FixArduinoMacros.hpp
NamespaceSettings.hpp
END_AH_NAMESPACE
#define END_AH_NAMESPACE
Definition:
NamespaceSettings.hpp:14
BEGIN_AH_NAMESPACE
#define BEGIN_AH_NAMESPACE
Definition:
NamespaceSettings.hpp:11
min
constexpr auto min(const T &a, const U &b) -> decltype(b< a ? b :a)
Return the smaller of two numbers/objects.
Definition:
MinMaxFix.hpp:12
max
constexpr auto max(const T &a, const U &b) -> decltype(a< b ? b :a)
Return the larger of two numbers/objects.
Definition:
MinMaxFix.hpp:19
Generated by
1.9.4