diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-10-26 21:16:58 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-10-26 21:16:58 +0000 |
commit | cf718c6de67bb267d5638bbece15ec9dbc9b3a6a (patch) | |
tree | 5d4368cbfae4ab27a7e7c8c1df2a6d1e758875a8 /libstdc++-v3 | |
parent | d878092fddb38d5f7d52388662245297c1185e5b (diff) | |
download | ppe42-gcc-cf718c6de67bb267d5638bbece15ec9dbc9b3a6a.tar.gz ppe42-gcc-cf718c6de67bb267d5638bbece15ec9dbc9b3a6a.zip |
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
is zero and simpler.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89608 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 7 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/basic_string.h | 11 |
2 files changed, 14 insertions, 4 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 6404896d390..94a2adb2ada 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +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 + is zero and simpler. + 2004-10-26 Benjamin Kosnik <bkoz@redhat.com> * include/ext/array_allocator.h (array::allocate): Check for valid diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index 817123365cc..34c6fab94a5 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -1140,8 +1140,11 @@ namespace std */ basic_string& erase(size_type __pos = 0, size_type __n = npos) - { return _M_replace_safe(_M_check(__pos, "basic_string::erase"), - _M_limit(__pos, __n), NULL, size_type(0)); } + { + _M_mutate(_M_check(__pos, "basic_string::erase"), + _M_limit(__pos, __n), size_type(0)); + return *this; + } /** * @brief Remove one character. @@ -1157,7 +1160,7 @@ namespace std _GLIBCXX_DEBUG_PEDASSERT(__position >= _M_ibegin() && __position < _M_iend()); const size_type __pos = __position - _M_ibegin(); - _M_replace_safe(__pos, size_type(1), NULL, size_type(0)); + _M_mutate(__pos, size_type(1), size_type(0)); _M_rep()->_M_set_leaked(); return _M_ibegin() + __pos; } @@ -1177,7 +1180,7 @@ namespace std _GLIBCXX_DEBUG_PEDASSERT(__first >= _M_ibegin() && __first <= __last && __last <= _M_iend()); const size_type __pos = __first - _M_ibegin(); - _M_replace_safe(__pos, __last - __first, NULL, size_type(0)); + _M_mutate(__pos, __last - __first, size_type(0)); _M_rep()->_M_set_leaked(); return _M_ibegin() + __pos; } |