sources/basics.h

changeset 17
50341dec533e
parent 15
33da84af4bba
child 27
089e37c0887e
--- a/sources/basics.h	Sun Dec 14 18:15:28 2014 +0200
+++ b/sources/basics.h	Sun Dec 14 19:38:47 2014 +0200
@@ -63,3 +63,9 @@
 using Function = std::function<Signature>;
 
 FUNCTION print_to_console (const String& a) -> void;
+
+template<typename T> inline FUNCTION
+clamp (T a, T b, T c) -> T
+{
+	return (a < b) ? b : (a > c) ? c : a;
+}

mercurial