… | |
… | |
256 | return pos; |
256 | return pos; |
257 | } |
257 | } |
258 | void erase (iterator first, iterator last) |
258 | void erase (iterator first, iterator last) |
259 | { |
259 | { |
260 | if (last != first) { |
260 | if (last != first) { |
261 | memmove (first, last, (end ()-last)*sizeof (T)); |
261 | memmove (first, last, (end () - last) * sizeof (T)); |
262 | _last -= last - first; |
262 | _last -= last - first; |
263 | } |
263 | } |
264 | } |
264 | } |
265 | void erase (iterator pos) |
265 | void erase (iterator pos) |
266 | { |
266 | { |
267 | if (pos != end ()) { |
267 | if (pos != end ()) { |
268 | memmove (pos, pos+1, (end ()- (pos+1))*sizeof (T)); |
268 | memmove (pos, pos+1, (end () - (pos+1)) * sizeof (T)); |
269 | --_last; |
269 | --_last; |
270 | } |
270 | } |
271 | } |
271 | } |
272 | void swap (simplevec<T> &t) |
272 | void swap (simplevec<T> &t) |
273 | { |
273 | { |
… | |
… | |
395 | for (char **c = begin (); c != end (); c++) |
395 | for (char **c = begin (); c != end (); c++) |
396 | delete [] *c; |
396 | delete [] *c; |
397 | } |
397 | } |
398 | }; |
398 | }; |
399 | |
399 | |
400 | // temporarily replace the process environment |
|
|
401 | extern char **environ; |
|
|
402 | |
|
|
403 | struct temp_environ |
|
|
404 | { |
|
|
405 | char **prev; |
|
|
406 | |
|
|
407 | temp_environ (const stringvec *envv) |
|
|
408 | : prev (environ) |
|
|
409 | { |
|
|
410 | if (envv) |
|
|
411 | environ = (char **)envv->begin (); |
|
|
412 | } |
|
|
413 | |
|
|
414 | ~temp_environ () |
|
|
415 | { |
|
|
416 | environ = prev; |
|
|
417 | } |
|
|
418 | }; |
|
|
419 | |
|
|
420 | #endif |
400 | #endif |
421 | |
401 | |