sources/basics.h

changeset 157
42bb29924218
parent 114
0e7f3ecdf65a
child 161
1c483b54ddcb
equal deleted inserted replaced
156:ce66d7e374bf 157:42bb29924218
88 T clamp (T a, T b, T c) 88 T clamp (T a, T b, T c)
89 { 89 {
90 return (a < b) ? b : (a > c) ? c : a; 90 return (a < b) ? b : (a > c) ? c : a;
91 } 91 }
92 92
93 inline const char *plural(int value)
94 {
95 return value != 1 ? "s" : "";
96 }
97
93 template <typename T, size_t N> 98 template <typename T, size_t N>
94 char (&_ArraySizeHelper(T (&array)[N]))[N]; 99 char (&_ArraySizeHelper(T (&array)[N]))[N];
95 #define countof(array) (sizeof(_ArraySizeHelper( array ))) 100 #define countof(array) (sizeof(_ArraySizeHelper( array )))
96 101
97 struct Exitception {}; 102 struct Exitception {};

mercurial