Today when I took part in the Round #740 solving problem D. Top-Notch Insertions, my submission failed on test 2 without knowing why. After asserting I found that rope contains unwanted contents and I didn't fix the problem during the contest.
However, when I replace all __gnu_cxx::rope.erase(x)
into __gnu_cxx::rope.erase(x, 1)
, my code works fine (idk if it will pass system test or not; at least, it passes asserting that all elements are rolled back to the initial state).
Then! I found it unbelievable to see the following code from here:
Look at the line 2318, comments: Erase, single character
.
However, it calls erase(__p, __p + 1);
, who will erase __p + 1
characters starting from the position __p
.
I found it incredible since it's part of libstdc++. I don't know if there's a way to report such failure. Could anyone tell me if I can do something with it? (or instead, NEVER USE SUCH FUNCTION IN THE FUTURE)
Thank you!
UPD: I've submitted the bug to gcc.
Fortunately, it's quickly replied by Jonathan Wakely. Unfortunately, just exactly as adamant predicted, Jonathan Wakely wrotes:
We should just delete this class, so I don't have to keep fixing bugs in code that nobody uses or cares about.