Control Surface  1.1.1
MIDI Control Surface library for Arduino
MinMaxFix.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 AH_DIAGNOSTIC_WERROR() // Enable errors on warnings
5 
6 #include <AH/Math/FixArduinoMacros.hpp>
7 
9 
11 
14 template <class T, class U>
15 constexpr auto min(const T &a, const U &b) -> decltype(b < a ? b : a) {
16  return b < a ? b : a;
17 }
18 
21 template <class T, class U>
22 constexpr auto max(const T &a, const U &b) -> decltype(a < b ? b : a) {
23  return a < b ? b : a;
24 }
25 
27 
Warnings.hpp
AH::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:15
AH_DIAGNOSTIC_POP
#define AH_DIAGNOSTIC_POP()
Definition: Warnings.hpp:17
AH_DIAGNOSTIC_WERROR
#define AH_DIAGNOSTIC_WERROR()
Definition: Warnings.hpp:16
BEGIN_AH_NAMESPACE
#define BEGIN_AH_NAMESPACE
Definition: AH/Settings/NamespaceSettings.hpp:9
END_AH_NAMESPACE
#define END_AH_NAMESPACE
Definition: AH/Settings/NamespaceSettings.hpp:10
NamespaceSettings.hpp
AH::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:22