diff --git a/libstdc++/ChangeLog b/libstdc++/ChangeLog index cb66cab1add..a1bf0a43461 100644 --- a/libstdc++/ChangeLog +++ b/libstdc++/ChangeLog @@ -1,3 +1,12 @@ +Fri Oct 10 00:40:00 1997 Jason Merrill + + * std/bastring.h: Use ibegin internally. Return passed iterator + instead of recalculating it were appropriate. + * std/bastring.cc: Adjust for erase. + + From Yotam Medini: + * std/bastring.h: Replace remove with erase. + Thu Oct 9 23:24:36 1997 Jason Merrill * stdexcepti.cc (__out_of_range): New fn. diff --git a/libstdc++/std/bastring.cc b/libstdc++/std/bastring.cc index 155656ae5d0..aa151da69d1 100644 --- a/libstdc++/std/bastring.cc +++ b/libstdc++/std/bastring.cc @@ -220,7 +220,7 @@ resize (size_t n, charT c) if (n > length ()) append (n - length (), c); else - remove (n); + erase (n); } template diff --git a/libstdc++/std/bastring.h b/libstdc++/std/bastring.h index 9eae46fce49..59a59958302 100644 --- a/libstdc++/std/bastring.h +++ b/libstdc++/std/bastring.h @@ -220,9 +220,9 @@ public: basic_string& insert (size_type pos, size_type n, charT c) { return replace (pos, 0, n, c); } iterator insert(iterator p, charT c) - { size_type pos = p - begin (); insert (pos, 1, c); return pos +begin (); } + { insert (p - ibegin (), 1, c); return p; } iterator insert(iterator p, size_type n, charT c) - { size_type pos = p - begin (); insert (pos, n, c); return pos +begin (); } + { insert (p - ibegin (), n, c); return p; } #ifdef __STL_MEMBER_TEMPLATES template void insert(iterator p, InputIterator first, InputIterator last) @@ -231,12 +231,12 @@ public: #endif { replace (p, p, first, last); } - basic_string& remove (size_type pos = 0, size_type n = npos) + basic_string& erase (size_type pos = 0, size_type n = npos) { return replace (pos, n, (size_type)0, (charT)0); } - basic_string& remove (iterator pos) - { return replace (pos - begin (), 1, (size_type)0, (charT)0); } - basic_string& remove (iterator first, iterator last) - { return replace (first - begin (), last - first, (size_type)0, (charT)0);} + iterator erase(iterator p) + { replace (p - ibegin (), 1, (size_type)0, (charT)0); return p; } + iterator erase(iterator f, iterator l) + { replace (f - ibegin (), l - f, (size_type)0, (charT)0); return f; } basic_string& replace (size_type pos1, size_type n1, const basic_string& str, size_type pos2 = 0, size_type n2 = npos); @@ -248,13 +248,13 @@ public: basic_string& replace (size_type pos, size_type n, charT c) { return replace (pos, n, 1, c); } basic_string& replace (iterator i1, iterator i2, const basic_string& str) - { return replace (i1 - begin (), i2 - i1, str); } + { return replace (i1 - ibegin (), i2 - i1, str); } basic_string& replace (iterator i1, iterator i2, const charT* s, size_type n) - { return replace (i1 - begin (), i2 - i1, s, n); } + { return replace (i1 - ibegin (), i2 - i1, s, n); } basic_string& replace (iterator i1, iterator i2, const charT* s) - { return replace (i1 - begin (), i2 - i1, s); } + { return replace (i1 - ibegin (), i2 - i1, s); } basic_string& replace (iterator i1, iterator i2, size_type n, charT c) - { return replace (i1 - begin (), i2 - i1, n, c); } + { return replace (i1 - ibegin (), i2 - i1, n, c); } #ifdef __STL_MEMBER_TEMPLATES template basic_string& replace(iterator i1, iterator i2,