diff -r 33bac54867bf -r 50341dec533e sources/basics.h --- 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; FUNCTION print_to_console (const String& a) -> void; + +template inline FUNCTION +clamp (T a, T b, T c) -> T +{ + return (a < b) ? b : (a > c) ? c : a; +}