aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2004-10-27 01:02:47 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2004-10-27 01:02:47 +0000
commitab4375af84fb7780d3a4c7f7a25521341931cf0c (patch)
tree2119195179286fe28ef87ad96340720305d87344
parent667e401793b82c86c680d21ad3f1cbcc08908aa6 (diff)
downloadgcc-ab4375af84fb7780d3a4c7f7a25521341931cf0c.zip
gcc-ab4375af84fb7780d3a4c7f7a25521341931cf0c.tar.gz
gcc-ab4375af84fb7780d3a4c7f7a25521341931cf0c.tar.bz2
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
-rw-r--r--libstdc++-v3/ChangeLog6
-rw-r--r--libstdc++-v3/include/bits/basic_string.h28
-rw-r--r--libstdc++-v3/include/bits/basic_string.tcc34
3 files changed, 42 insertions, 26 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 94a2adb..f51f6f1 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,11 @@
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),
erase(iterator), erase(iterator, iterator)): Call _M_mutate
instead of _M_replace_safe, equivalent when the fourth argument
diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index 34c6fab..6550b9c 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -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.
diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc
index 9e59e2c..6bd1296 100644
--- a/libstdc++-v3/include/bits/basic_string.tcc
+++ b/libstdc++-v3/include/bits/basic_string.tcc
@@ -264,6 +264,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>::
append(const _CharT* __s, size_type __n)
{
__glibcxx_requires_string_len(__s, __n);
@@ -291,6 +308,23 @@ namespace std
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>::
append(const basic_string& __str, size_type __pos, size_type __n)
{
__str._M_check(__pos, "basic_string::append");