diff options
author | Paolo Carlini <pcarlini@suse.de> | 2004-04-19 11:30:20 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2004-04-19 11:30:20 +0000 |
commit | 41b8e86c9abcb1dbf93c78a1a8529ade77e39ff5 (patch) | |
tree | 46ccf576c3eb7f46f6e4062abf533bbed1597876 | |
parent | d6ce65ee1997a6a491a713c1e0e8b4d09e8d110f (diff) | |
download | gcc-41b8e86c9abcb1dbf93c78a1a8529ade77e39ff5.zip gcc-41b8e86c9abcb1dbf93c78a1a8529ade77e39ff5.tar.gz gcc-41b8e86c9abcb1dbf93c78a1a8529ade77e39ff5.tar.bz2 |
PR libstdc++/15002 (partial)
2004-04-19 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/15002 (partial)
* include/bits/basic_string.h (_M_replace_aux, _M_replace_safe):
Special case __n2 == 1, not calling traits_type::assign/copy.
From-SVN: r80847
-rw-r--r-- | libstdc++-v3/ChangeLog | 6 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/basic_string.h | 10 |
2 files changed, 13 insertions, 3 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index cbae312..0654d76 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2004-04-19 Paolo Carlini <pcarlini@suse.de> + + PR libstdc++/15002 (partial) + * include/bits/basic_string.h (_M_replace_aux, _M_replace_safe): + Special case __n2 == 1, not calling traits_type::assign/copy. + 2004-04-17 Benjamin Kosnik <bkoz@redhat.com> * include/bits/stl_bvector.h: Use _M_impl._M_start. diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index a33cdef..6837e01 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -1342,7 +1342,9 @@ namespace std if (this->max_size() - (this->size() - __n1) < __n2) __throw_length_error(__N("basic_string::_M_replace_aux")); _M_mutate(__pos1, __n1, __n2); - if (__n2) + if (__n2 == 1) + _M_data()[__pos1] = __c; + else if (__n2) traits_type::assign(_M_data() + __pos1, __n2, __c); return *this; } @@ -1352,7 +1354,9 @@ namespace std size_type __n2) { _M_mutate(__pos1, __n1, __n2); - if (__n2) + if (__n2 == 1) + _M_data()[__pos1] = *__s; + else if (__n2) traits_type::copy(_M_data() + __pos1, __s, __n2); return *this; } @@ -1960,7 +1964,7 @@ namespace std * @param rhs Last string. * @return New string with value of @a lhs followed by @a rhs. */ - template<typename _CharT, typename _Traits, typename _Alloc> + template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc> operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) |