… | |
… | |
110 | { |
110 | { |
111 | erase ((unsigned int )(i - this->begin ())); |
111 | erase ((unsigned int )(i - this->begin ())); |
112 | } |
112 | } |
113 | }; |
113 | }; |
114 | |
114 | |
|
|
115 | template<typename T, typename U> static inline T min (T a, U b) { return a < (T)b ? a : (T)b; } |
|
|
116 | template<typename T, typename U> static inline T max (T a, U b) { return a > (T)b ? a : (T)b; } |
|
|
117 | template<typename T, typename U, typename V> static inline T clamp (T v, U a, V b) { return v < (T)a ? a : v >(T)b ? b : v; } |
|
|
118 | |
|
|
119 | template<typename T, typename U> static inline void swap (T& a, U& b) { T t=a; a=(T)b; b=(U)t; } |
|
|
120 | |
|
|
121 | // basically does what strncpy should do, but appends "..." to strings exceeding length |
|
|
122 | void assign (char *dst, const char *src, int maxlen); |
|
|
123 | |
|
|
124 | // type-safe version of assign |
|
|
125 | template<int N> |
|
|
126 | inline void assign (char (&dst)[N], const char *src) |
|
|
127 | { |
|
|
128 | assign ((char *)&dst, src, N); |
|
|
129 | } |
|
|
130 | |
115 | #endif |
131 | #endif |
116 | |
132 | |