summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2013-04-23 19:08:44 +0200
committerMaxime Coste <frrrwww@gmail.com>2013-04-23 19:08:44 +0200
commitef07b982158865cb08d8fe2aebd47cf31b2de898 (patch)
tree2a433d96b5326a8f7947df1f0a833d1f15f0a2bb /src
parent6913510e6720e990fc0cb9f582e6ca40cbe97501 (diff)
utils: add is_in_range function
Diffstat (limited to 'src')
-rw-r--r--src/utils.hh6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/utils.hh b/src/utils.hh
index 56bc7527..e7315cc2 100644
--- a/src/utils.hh
+++ b/src/utils.hh
@@ -228,6 +228,12 @@ const T& clamp(const T& val, const T& min, const T& max)
return (val < min ? min : (val > max ? max : val));
}
+template<typename T>
+bool is_in_range(const T& val, const T& min, const T& max)
+{
+ return min <= val and val <= max;
+}
+
// *** AutoRegister: RAII handling of value semantics registering classes ***
template<typename EffectiveType, typename RegisterFuncs, typename Registry>