diff options
author | drepper <drepper@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-07-02 15:57:12 +0000 |
---|---|---|
committer | drepper <drepper@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-07-02 15:57:12 +0000 |
commit | b6fe7008c79696cc2517f86fa01ee83b6a3d397f (patch) | |
tree | 21774c4815e51b54344bf44903b6f857d20d0dbd /libstdc++ | |
parent | d6ff8d832d191317ae3b737d725c3b672bd49483 (diff) | |
download | gcc-b6fe7008c79696cc2517f86fa01ee83b6a3d397f.tar.gz |
(class basic_string): Return correct iterators in erase member functions.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@20906 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++')
-rw-r--r-- | libstdc++/std/bastring.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libstdc++/std/bastring.h b/libstdc++/std/bastring.h index 8b009a4ad8c..5e334e666ff 100644 --- a/libstdc++/std/bastring.h +++ b/libstdc++/std/bastring.h @@ -227,9 +227,13 @@ public: basic_string& erase (size_type pos = 0, size_type n = npos) { return replace (pos, n, (size_type)0, (charT)0); } iterator erase(iterator p) - { replace (p-ibegin (), 1, (size_type)0, (charT)0); selfish (); return p; } + { size_type __o = p - begin(); + replace (__o, 1, (size_type)0, (charT)0); selfish (); + return ibegin() + __o; } iterator erase(iterator f, iterator l) - { replace (f-ibegin (), l-f, (size_type)0, (charT)0);selfish ();return f; } + { size_type __o = f - ibegin(); + replace (__o, l-f, (size_type)0, (charT)0);selfish (); + return ibegin() + __o; } basic_string& replace (size_type pos1, size_type n1, const basic_string& str, size_type pos2 = 0, size_type n2 = npos); |