ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libptytty/src/estl.h
(Generate patch)

Comparing libptytty/src/estl.h (file contents):
Revision 1.9 by root, Sat May 19 01:03:36 2012 UTC vs.
Revision 1.10 by root, Sat May 19 01:19:03 2012 UTC

263 T &operator [](size_type idx) { return buf[idx]; } 263 T &operator [](size_type idx) { return buf[idx]; }
264 264
265 iterator insert (iterator pos, const T &t) 265 iterator insert (iterator pos, const T &t)
266 { 266 {
267 size_type at = pos - begin (); 267 size_type at = pos - begin ();
268
268 ins (pos, 1); 269 ins (pos, 1);
269 buf [pos] = t; 270 buf [at] = t;
270 return pos; 271
272 return buf + at;
271 } 273 }
272 274
273 iterator insert (iterator pos, const_iterator first, const_iterator last) 275 iterator insert (iterator pos, const_iterator first, const_iterator last)
274 { 276 {
275 size_type n = last - first; 277 size_type n = last - first;
276 size_type at = pos - begin (); 278 size_type at = pos - begin ();
277 279
278 ins (pos, n); 280 ins (pos, n);
279 copy (pos, first, n, cop_set); 281 copy (buf + at, first, n, cop_set);
280 282
281 return pos; 283 return buf + at;
282 } 284 }
283 285
284 iterator insert (iterator pos, size_type n, const T &t) 286 iterator insert (iterator pos, size_type n, const T &t)
285 { 287 {
286 size_type at = pos - begin (); 288 size_type at = pos - begin ();
287 289
288 ins (pos, n); 290 ins (pos, n);
289 291
290 for (size_type i = 0; i < n; ++i) 292 for (iterator i = buf + at; n--; )
291 buf [at + i] = t; 293 *i++ = t;
292 294
293 return pos; 295 return buf + at;
294 } 296 }
295 297
296 void erase (iterator first, iterator last) 298 void erase (iterator first, iterator last)
297 { 299 {
298 size_t n = last - first; 300 size_t n = last - first;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines