libstdc++: Remove __gnu_cxx::rope::erase(size_type) [PR102048]
authorJonathan Wakely <jwakely@redhat.com>
Wed, 25 Aug 2021 15:42:49 +0000 (16:42 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 25 Aug 2021 21:28:46 +0000 (22:28 +0100)
commit2cd229dec8d6716938de5052479d059d306969da
treea3dbfe9728bb93c6cfdb3145b4c0df459f427061
parent971df602e0a798fe9c805c3105f4ac80d638a12b
libstdc++: Remove __gnu_cxx::rope::erase(size_type) [PR102048]

This function claims to remove a single character at index p, but it
actually removes p+1 characters beginning at p. So r.erase(0) removes
the first character, but r.erase(1) removes the second and third, and
r.erase(2) removes the second, third and fourth. This is not a useful
API.

The overload is present in the SGI STL <stl_rope.h> header that we
imported, but it isn't documented in the API reference. The erase
overloads that are documented are:

erase(const iterator& p)
erase(const iterator& f, const iterator& l)
erase(size_type i, size_type n);

Having an erase(size_type p) overload that erases a single character (as
the comment says it does) might be useful, but would be inconsistent
with std::basic_string::erase(size_type p = 0, size_type n = npos),
which erases from p to the end of the string when called with a single
argument.

Since the function isn't part of the documented API, doesn't do what it
claims to do (or anything useful) and "fixing" it would leave it
inconsistent with basic_string, I'm just removing that overload.

libstdc++-v3/ChangeLog:

PR libstdc++/102048
* include/ext/rope (rope::erase(size_type)): Remove broken
function.
libstdc++-v3/include/ext/rope