cgv
min.h
1 #pragma once
2 
3 #include <climits>
4 #include <float.h>
5 
6 namespace cgv {
7  namespace type {
8  namespace traits {
11  template <typename T> struct min {};
12  template <> struct min<char> { static const char value = CHAR_MIN; };
13  template <> struct min<short> { static const short value = SHRT_MIN; };
14  template <> struct min<int> { static const int value = INT_MIN; };
15  template <> struct min<long> { static const long value = LONG_MIN; };
16  template <> struct min<unsigned char> { static const unsigned char value = 0; };
17  template <> struct min<unsigned short> { static const unsigned short value = 0; };
18  template <> struct min<unsigned int> { static const unsigned int value = 0; };
19  template <> struct min<unsigned long> { static const unsigned long value = 0; };
20 
23  template <typename T> struct min_fct { static T get_value() { return min<T>::value; } };
24  template <> struct min_fct<float> { static float get_value() { return -FLT_MAX; } };
25  template <> struct min_fct<double> { static double get_value() { return -DBL_MAX; } };
26  }
27  }
28 }
cgv::type::traits::min
Definition: min.h:11
cgv
the cgv namespace
Definition: vr_calib.cxx:9
cgv::type::traits::min_fct
Definition: min.h:23