173:248fba6d1e76 | 179:7fc34735178e |
---|---|
27 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 27 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #pragma once | 31 #pragma once |
32 #include <type_traits> | |
32 #include <stdlib.h> | 33 #include <stdlib.h> |
33 | 34 |
34 #if !defined(_MSC_VER) && !defined(__cdecl) | 35 #if !defined(_MSC_VER) && !defined(__cdecl) |
35 # define __cdecl | 36 # define __cdecl |
36 #endif | 37 #endif |
104 result = max(result, element); | 105 result = max(result, element); |
105 | 106 |
106 return result; | 107 return result; |
107 } | 108 } |
108 | 109 |
109 template<typename T> | 110 template<typename T, typename TT, typename TTT> |
110 T clamp (T a, T b, T c) | 111 std::common_type_t<T, TT, TTT> clamp(T a, TT b, TTT c) |
111 { | 112 { |
112 return (a < b) ? b : (a > c) ? c : a; | 113 return (a < b) ? b : (a > c) ? c : a; |
113 } | 114 } |
114 | 115 |
115 inline const char *plural(int value) | 116 inline const char *plural(int value) |