428. string::erase(iterator) validity

Section: 24.3.2.6.5 [string.erase] Status: CD1 Submitter: Martin Sebor Opened: 2003-09-18 Last modified: 2016-11-12

Priority: Not Prioritized

View all other issues in [string.erase].

View all issues with CD1 status.

Discussion:

23.1.1, p3 along with Table 67 specify as a prerequisite for a.erase(q) that q must be a valid dereferenceable iterator into the sequence a.

However, 21.3.5.5, p5 describing string::erase(p) only requires that p be a valid iterator.

This may be interepreted as a relaxation of the general requirement, which is most likely not the intent.

Proposed resolution:

Remove 24.3.2.6.5 [string.erase] paragraph 5.

Rationale:

The LWG considered two options: changing the string requirements to match the general container requirements, or just removing the erroneous string requirements altogether. The LWG chose the latter option, on the grounds that duplicating text always risks the possibility that it might be duplicated incorrectly.