1 | #ifndef RXVT_UTIL_H |
1 | #ifndef RXVT_UTIL_H |
2 | #define RXVT_UTIL_H |
2 | #define RXVT_UTIL_H |
3 | |
3 | |
|
|
4 | #include <cstdlib> |
4 | #include <cstring> |
5 | #include <cstring> |
5 | |
6 | |
6 | #define PP_CONCAT_(a, b) a ## b |
7 | #define PP_CONCAT_(a, b) a ## b |
7 | #define PP_CONCAT(a, b) PP_CONCAT_(a, b) |
8 | #define PP_CONCAT(a, b) PP_CONCAT_(a, b) |
8 | #define PP_STRINGIFY_(a) #a |
9 | #define PP_STRINGIFY_(a) #a |
… | |
… | |
256 | return pos; |
257 | return pos; |
257 | } |
258 | } |
258 | void erase (iterator first, iterator last) |
259 | void erase (iterator first, iterator last) |
259 | { |
260 | { |
260 | if (last != first) { |
261 | if (last != first) { |
261 | memmove (first, last, (end ()-last)*sizeof (T)); |
262 | memmove (first, last, (end () - last) * sizeof (T)); |
262 | _last -= last - first; |
263 | _last -= last - first; |
263 | } |
264 | } |
264 | } |
265 | } |
265 | void erase (iterator pos) |
266 | void erase (iterator pos) |
266 | { |
267 | { |
267 | if (pos != end ()) { |
268 | if (pos != end ()) { |
268 | memmove (pos, pos+1, (end ()- (pos+1))*sizeof (T)); |
269 | memmove (pos, pos+1, (end () - (pos+1)) * sizeof (T)); |
269 | --_last; |
270 | --_last; |
270 | } |
271 | } |
271 | } |
272 | } |
272 | void swap (simplevec<T> &t) |
273 | void swap (simplevec<T> &t) |
273 | { |
274 | { |
… | |
… | |
391 | struct stringvec : simplevec<char *> |
392 | struct stringvec : simplevec<char *> |
392 | { |
393 | { |
393 | ~stringvec () |
394 | ~stringvec () |
394 | { |
395 | { |
395 | for (char **c = begin (); c != end (); c++) |
396 | for (char **c = begin (); c != end (); c++) |
396 | delete [] *c; |
397 | free (*c); |
397 | } |
398 | } |
398 | }; |
399 | }; |
399 | |
400 | |
400 | #endif |
401 | #endif |
401 | |
402 | |