sources/basics.h

changeset 179
7fc34735178e
parent 161
1c483b54ddcb
child 181
e254398fcc7c
--- a/sources/basics.h	Wed Jan 27 12:38:00 2021 +0200
+++ b/sources/basics.h	Wed Jan 27 13:02:51 2021 +0200
@@ -29,6 +29,7 @@
 */
 
 #pragma once
+#include <type_traits>
 #include <stdlib.h>
 
 #if !defined(_MSC_VER) && !defined(__cdecl)
@@ -106,8 +107,8 @@
 	return result;
 }
 
-template<typename T>
-T clamp (T a, T b, T c)
+template<typename T, typename TT, typename TTT>
+std::common_type_t<T, TT, TTT> clamp(T a, TT b, TTT c)
 {
 	return (a < b) ? b : (a > c) ? c : a;
 }

mercurial