clamp.h

Go to the documentation of this file.
00001 #ifndef __UTIL__CLAMP_HPP__
00002 #define __UTIL__CLAMP_HPP__
00003 
00009 #include <config.h>
00010 namespace util {
00019   template <class T> T clamp(const T& val, const T& min, const T& max) {
00020     if (min >= max) return max;
00021     else if (val < min) return min;
00022     else if (val > max) return max;
00023     else return val;
00024   }
00025 }
00026 
00027 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Fri May 31 15:37:52 2013 for VVE by  doxygen 1.6.3