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 {}; |