utils: add is_in_range function

This commit is contained in:
Maxime Coste 2013-04-23 19:08:44 +02:00
parent 6913510e67
commit ef07b98215

View File

@ -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>