Changeset ed81b1f in mainline for uspace/lib/cpp/include/impl/string.hpp
- Timestamp:
- 2018-07-05T21:41:18Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e502572b
- Parents:
- 2d302d6
- git-author:
- Jaroslav Jindrak <dzejrou@…> (2017-11-01 19:07:07)
- git-committer:
- Dzejrou <dzejrou@…> (2018-07-05 21:41:18)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/include/impl/string.hpp
r2d302d6 red81b1f 331 331 : data_{}, size_{}, capacity_{}, allocator_{alloc} 332 332 { 333 init_(str, traits_type::length(str) + 1);333 init_(str, traits_type::length(str)); 334 334 } 335 335 … … 361 361 { 362 362 auto len = static_cast<size_type>(last - first); 363 init_( static_cast<value_type*>(first), len);363 init_(first, len); 364 364 } 365 365 } … … 501 501 size_type length() const noexcept 502 502 { 503 return size _;503 return size(); 504 504 } 505 505 … … 652 652 // TODO: if (size_ + n > max_size()) throw length_error 653 653 ensure_free_space_(n); 654 traits_type::copy(data_ + size _ - 1, str, n);655 size_ += n - 1; // We are not copying str's null terminator.654 traits_type::copy(data_ + size(), str, n); 655 size_ += n; 656 656 ensure_null_terminator_(); 657 657 … … 661 661 basic_string& append(const value_type* str) 662 662 { 663 return append(str, traits_type::length(str) + 1);663 return append(str, traits_type::length(str)); 664 664 } 665 665 … … 769 769 770 770 copy_backward_(begin() + pos, end(), end() + n); 771 std::printf("|%s|\n", data_);772 771 copy_(str, str + n, begin() + pos); 773 772 size_ += n;
Note:
See TracChangeset
for help on using the changeset viewer.