Changeset 83aea53 in mainline
- Timestamp:
- 2018-07-05T21:41:17Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b4b01cb
- Parents:
- b946b052
- git-author:
- Jaroslav Jindrak <dzejrou@…> (2017-10-25 17:03:18)
- git-committer:
- Dzejrou <dzejrou@…> (2018-07-05 21:41:17)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/include/impl/vector.hpp
rb946b052 r83aea53 394 394 auto pos = const_cast<iterator>(position); 395 395 396 shift_(pos, 1);397 allocator_.construct(pos, std::forward<Args>(args)...);396 pos = shift_(pos, 1); 397 allocator_.construct(pos, forward<Args>(args)...); 398 398 399 399 return pos; … … 404 404 auto pos = const_cast<iterator>(position); 405 405 406 shift_(pos, 1);406 pos = shift_(pos, 1); 407 407 *pos = x; 408 408 409 ++size_;410 409 return pos; 411 410 } … … 415 414 auto pos = const_cast<iterator>(position); 416 415 417 shift_(pos, 1);416 pos = shift_(pos, 1); 418 417 *pos = forward<value_type>(x); 419 418 420 ++size_;421 419 return pos; 422 420 } … … 426 424 auto pos = const_cast<iterator>(position); 427 425 428 shift_(pos, count);426 pos = shift_(pos, count); 429 427 auto copy_target = pos; 430 428 for (size_type i = 0; i < count; ++i) 431 429 *copy_target++ = x; 432 430 433 size_ += count;434 431 return pos; 435 432 } … … 442 439 auto count = static_cast<size_type>(last - first); 443 440 444 shift_(pos, count); 445 std::copy(first, last, pos); 446 447 size_ += count; 441 pos = shift_(pos, count); 442 copy(first, last, pos); 443 448 444 return pos; 449 445 } … … 453 449 auto pos = const_cast<iterator>(position); 454 450 455 shift_(pos, init.size()); 456 std::copy(init.begin(), init.end(), pos); 457 458 size_ += init.size(); 451 pos = shift_(pos, init.size()); 452 copy(init.begin(), init.end(), pos); 453 459 454 return pos; 460 455 } … … 550 545 } 551 546 552 voidshift_(iterator position, size_type count)547 iterator shift_(iterator position, size_type count) 553 548 { 554 549 if (size_ + count < capacity_) 555 std::copy_backwards(pos, end(), end() + count); 550 { 551 copy_backward(position, end(), end() + count); 552 size_ += count; 553 554 return position; 555 } 556 556 else 557 557 { … … 566 566 567 567 // Copy before insertion index. 568 std::copy(tmp.begin(), tmp.begin() + start_idx,begin());568 copy(begin(), begin() + start_idx, tmp.begin()); 569 569 570 570 // Copy after insertion index. 571 std::copy(tmp.begin() + end_idx, tmp.end(), begin() + start_idx);571 copy(begin() + start_idx, end(), tmp.begin() + end_idx); 572 572 573 573 swap(tmp); 574 575 // Position was invalidated! 576 return begin() + start_idx; 574 577 } 575 578 }
Note:
See TracChangeset
for help on using the changeset viewer.