mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-02 16:23:56 +08:00
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:
parent
667e401793
commit
ab4375af84
@ -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>
|
2004-10-26 Paolo Carlini <pcarlini@suse.de>
|
||||||
|
|
||||||
* include/bits/basic_string.h (erase(size_type, size_type),
|
* include/bits/basic_string.h (erase(size_type, size_type),
|
||||||
|
@ -776,19 +776,7 @@ namespace std
|
|||||||
* @return Reference to this string.
|
* @return Reference to this string.
|
||||||
*/
|
*/
|
||||||
basic_string&
|
basic_string&
|
||||||
append(const basic_string& __str)
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Append a substring.
|
* @brief Append a substring.
|
||||||
@ -835,19 +823,7 @@ namespace std
|
|||||||
* Appends n copies of c to this string.
|
* Appends n copies of c to this string.
|
||||||
*/
|
*/
|
||||||
basic_string&
|
basic_string&
|
||||||
append(size_type __n, _CharT __c)
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Append a range of characters.
|
* @brief Append a range of characters.
|
||||||
|
@ -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>
|
template<typename _CharT, typename _Traits, typename _Alloc>
|
||||||
basic_string<_CharT, _Traits, _Alloc>&
|
basic_string<_CharT, _Traits, _Alloc>&
|
||||||
basic_string<_CharT, _Traits, _Alloc>::
|
basic_string<_CharT, _Traits, _Alloc>::
|
||||||
@ -288,6 +305,23 @@ namespace std
|
|||||||
return *this;
|
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>
|
template<typename _CharT, typename _Traits, typename _Alloc>
|
||||||
basic_string<_CharT, _Traits, _Alloc>&
|
basic_string<_CharT, _Traits, _Alloc>&
|
||||||
basic_string<_CharT, _Traits, _Alloc>::
|
basic_string<_CharT, _Traits, _Alloc>::
|
||||||
|
Loading…
Reference in New Issue
Block a user