Changeset 53e8686 in mainline
- 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:
- 173a246
- Parents:
- d466d284
- git-author:
- Jaroslav Jindrak <dzejrou@…> (2017-11-01 20:30:32)
- git-committer:
- Dzejrou <dzejrou@…> (2018-07-05 21:41:18)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/include/impl/string.hpp
rd466d284 r53e8686 339 339 data_ = allocator_.allocate(capacity_); 340 340 for (size_type i = 0; i < size_; ++i) 341 traits_type::as ign(data_[i], c);341 traits_type::assign(data_[i], c); 342 342 ensure_null_terminator_(); 343 343 } … … 888 888 size_type n2) 889 889 { 890 // TODO: format and comment this properly891 890 // TODO: throw out_of_range if pos > size() 891 // TODO: if size() - len > max_size() - n2 throw length_error 892 892 auto len = min(n1, size_ - pos); 893 // TODO: if size() - len > max_size() - n2 throw length_error 893 894 894 basic_string tmp{}; 895 895 tmp.resize_without_copy_(size_ - len + n2); 896 897 // Prefix. 896 898 copy_(begin(), begin() + pos, tmp.begin()); 897 traits_type::copy(tmp.begin() + pos + 1, str, n2); 898 copy_(begin() + pos + len, end(), tmp.begin() + pos + 1 + n2); 899 900 // Substitution. 901 traits_type::copy(tmp.begin() + pos, str, n2); 902 903 // Suffix. 904 copy_(begin() + pos + len, end(), tmp.begin() + pos + n2); 905 906 tmp.size_ = size_ - len + n2; 899 907 swap(tmp); 900 908 return *this; … … 960 968 void swap(basic_string& other) 961 969 noexcept(allocator_traits<allocator_type>::propagate_on_container_swap::value || 962 allocator_traits<allocator_type>::is_always_equal )970 allocator_traits<allocator_type>::is_always_equal::value) 963 971 { 964 972 std::swap(data_, other.data_);
Note:
See TracChangeset
for help on using the changeset viewer.