basic_string.h (append(const basic_string&), [...]): Move out of line...

2004-10-26  Paolo Carlini  <pcarlini@suse.de>

	* include/bits/basic_string.h (append(const basic_string&),
	append(size_type, _CharT)): Move out of line...
	* include/bits/basic_string.tcc: ... here.

From-SVN: r89622
This commit is contained in:
Paolo Carlini 2004-10-27 01:02:47 +00:00 committed by Paolo Carlini
parent 667e401793
commit ab4375af84
3 changed files with 42 additions and 26 deletions

View File

@ -1,3 +1,9 @@
2004-10-26 Paolo Carlini <pcarlini@suse.de>
* include/bits/basic_string.h (append(const basic_string&),
append(size_type, _CharT)): Move out of line...
* include/bits/basic_string.tcc: ... here.
2004-10-26 Paolo Carlini <pcarlini@suse.de>
* include/bits/basic_string.h (erase(size_type, size_type),

View File

@ -776,19 +776,7 @@ namespace std
* @return Reference to this string.
*/
basic_string&
append(const basic_string& __str)
{
const size_type __size = __str.size();
if (__size)
{
const size_type __len = __size + this->size();
if (__len > this->capacity() || _M_rep()->_M_is_shared())
this->reserve(__len);
_M_copy(_M_data() + this->size(), __str._M_data(), __size);
_M_rep()->_M_set_length_and_sharable(__len);
}
return *this;
}
append(const basic_string& __str);
/**
* @brief Append a substring.
@ -835,19 +823,7 @@ namespace std
* Appends n copies of c to this string.
*/
basic_string&
append(size_type __n, _CharT __c)
{
if (__n)
{
_M_check_length(size_type(0), __n, "basic_string::append");
const size_type __len = __n + this->size();
if (__len > this->capacity() || _M_rep()->_M_is_shared())
this->reserve(__len);
_M_assign(_M_data() + this->size(), __n, __c);
_M_rep()->_M_set_length_and_sharable(__len);
}
return *this;
}
append(size_type __n, _CharT __c);
/**
* @brief Append a range of characters.

View File

@ -261,6 +261,23 @@ namespace std
}
}
template<typename _CharT, typename _Traits, typename _Alloc>
basic_string<_CharT, _Traits, _Alloc>&
basic_string<_CharT, _Traits, _Alloc>::
append(size_type __n, _CharT __c)
{
if (__n)
{
_M_check_length(size_type(0), __n, "basic_string::append");
const size_type __len = __n + this->size();
if (__len > this->capacity() || _M_rep()->_M_is_shared())
this->reserve(__len);
_M_assign(_M_data() + this->size(), __n, __c);
_M_rep()->_M_set_length_and_sharable(__len);
}
return *this;
}
template<typename _CharT, typename _Traits, typename _Alloc>
basic_string<_CharT, _Traits, _Alloc>&
basic_string<_CharT, _Traits, _Alloc>::
@ -288,6 +305,23 @@ namespace std
return *this;
}
template<typename _CharT, typename _Traits, typename _Alloc>
basic_string<_CharT, _Traits, _Alloc>&
basic_string<_CharT, _Traits, _Alloc>::
append(const basic_string& __str)
{
const size_type __size = __str.size();
if (__size)
{
const size_type __len = __size + this->size();
if (__len > this->capacity() || _M_rep()->_M_is_shared())
this->reserve(__len);
_M_copy(_M_data() + this->size(), __str._M_data(), __size);
_M_rep()->_M_set_length_and_sharable(__len);
}
return *this;
}
template<typename _CharT, typename _Traits, typename _Alloc>
basic_string<_CharT, _Traits, _Alloc>&
basic_string<_CharT, _Traits, _Alloc>::