-
- template<typename _CharT, typename _Traits, typename _Alloc>
- basic_string<_CharT, _Traits, _Alloc>&
- basic_string<_CharT, _Traits, _Alloc>::
- append(const basic_string& __str)
- {
- // Iff appending itself, string needs to pre-reserve the
- // correct size so that _M_mutate does not clobber the
- // pointer __str._M_data() formed here.
- const size_type __size = __str.size();
- const size_type __len = __size + this->size();
- if (__len > this->capacity())
- this->reserve(__len);
- return _M_replace_safe(this->size(), size_type(0), __str._M_data(),
- __str.size());
- }
-
- template<typename _CharT, typename _Traits, typename _Alloc>
- basic_string<_CharT, _Traits, _Alloc>&
- basic_string<_CharT, _Traits, _Alloc>::
- append(const basic_string& __str, size_type __pos, size_type __n)
- {
- // Iff appending itself, string needs to pre-reserve the
- // correct size so that _M_mutate does not clobber the
- // pointer __str._M_data() formed here.
- __str._M_check(__pos, "basic_string::append");
- __n = __str._M_limit(__pos, __n);
- const size_type __len = __n + this->size();
- if (__len > this->capacity())
- this->reserve(__len);
- return _M_replace_safe(this->size(), size_type(0), __str._M_data()
- + __pos, __n);
- }
-
- template<typename _CharT, typename _Traits, typename _Alloc>
- basic_string<_CharT, _Traits, _Alloc>&
- basic_string<_CharT, _Traits, _Alloc>::
- append(const _CharT* __s, size_type __n)
- {
- __glibcxx_requires_string_len(__s, __n);
- const size_type __len = __n + this->size();
- if (__len > this->capacity())
- this->reserve(__len);
- return _M_replace_safe(this->size(), size_type(0), __s, __n);
- }
-