27. String::erase(range) yields wrong iterator

Section: 27.4.3.7.5 [string.erase] Status: TC1 Submitter: Nathan Myers Opened: 1998-08-06 Last modified: 2016-11-12

Priority: Not Prioritized

View all other issues in [string.erase].

View all issues with TC1 status.

Discussion:

The string::erase(iterator first, iterator last) is specified to return an element one place beyond the next element after the last one erased. E.g. for the string "abcde", erasing the range ['b'..'d') would yield an iterator for element 'e', while 'd' has not been erased.

Proposed resolution:

In 27.4.3.7.5 [string.erase], paragraph 10, change:

Returns: an iterator which points to the element immediately following _last_ prior to the element being erased.

to read

Returns: an iterator which points to the element pointed to by _last_ prior to the other elements being erased.