sources/basics.h

branch
protocol5
changeset 159
970d58a01e8b
parent 157
42bb29924218
child 161
1c483b54ddcb
equal deleted inserted replaced
155:9f71f854474a 159:970d58a01e8b
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