https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102048
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Last reconfirmed| |2021-08-24 Status|UNCONFIRMED |NEW --- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- This would fix it, and provide the API that was apparently intended: --- a/libstdc++-v3/include/ext/rope +++ b/libstdc++-v3/include/ext/rope @@ -2401,11 +2401,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION this->_M_tree_ptr = __result; } - // Erase, single character - void - erase(size_type __p) - { erase(__p, __p + 1); } - // Insert, iterator variants. iterator insert(const iterator& __p, const rope& __r) If we want to retain an erase function that erases a single character, we could do: @@ -2393,7 +2393,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Erase, (position, size) variant. void - erase(size_type __p, size_type __n) + erase(size_type __p, size_type __n = 1) { _RopeRep* __result = replace(this->_M_tree_ptr, __p, __p + __n, 0); But to be consistent with std::string it should erase from that position to the end of the string: @@ -2393,7 +2393,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Erase, (position, size) variant. void - erase(size_type __p, size_type __n) + erase(size_type __p, size_type __n = npos) { _RopeRep* __result = replace(this->_M_tree_ptr, __p, __p + __n, 0); So maybe we should just remove it, since it's currently broken and "fixing" it would be inconsistent with std::string.