From ef07b982158865cb08d8fe2aebd47cf31b2de898 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 23 Apr 2013 19:08:44 +0200 Subject: [PATCH] utils: add is_in_range function --- src/utils.hh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/utils.hh b/src/utils.hh index 56bc75275..e7315cc21 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 +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