Commit 41b8e86c by Paolo Carlini Committed by Paolo Carlini

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
parent d6ce65ee
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> 2004-04-17 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/stl_bvector.h: Use _M_impl._M_start. * include/bits/stl_bvector.h: Use _M_impl._M_start.
......
...@@ -1342,7 +1342,9 @@ namespace std ...@@ -1342,7 +1342,9 @@ namespace std
if (this->max_size() - (this->size() - __n1) < __n2) if (this->max_size() - (this->size() - __n1) < __n2)
__throw_length_error(__N("basic_string::_M_replace_aux")); __throw_length_error(__N("basic_string::_M_replace_aux"));
_M_mutate(__pos1, __n1, __n2); _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); traits_type::assign(_M_data() + __pos1, __n2, __c);
return *this; return *this;
} }
...@@ -1352,7 +1354,9 @@ namespace std ...@@ -1352,7 +1354,9 @@ namespace std
size_type __n2) size_type __n2)
{ {
_M_mutate(__pos1, __n1, __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); traits_type::copy(_M_data() + __pos1, __s, __n2);
return *this; return *this;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment