2760. non-const basic_string::data should not invalidate iterators

Section: 24.3.2.1 [string.require] Status: C++17 Submitter: Billy Baker Opened: 2016-08-03 Last modified: 2017-07-30

Priority: Not Prioritized

View all other issues in [string.require].

View all issues with C++17 status.

Discussion:

24.3.2.1 [string.require]/4 does not list non-const basic_string::data() as being a function that may be called with the guarantee that it will not invalidate references, pointers, and iterators to elements of a basic_string object.

[2016-08 Chicago]

Wed PM: Move to Tentatively Ready

Proposed resolution:

This wording is relative to N4606.

  1. Change 24.3.2.1 [string.require]/4 as indicated:

    -4- References, pointers, and iterators referring to the elements of a basic_string sequence may be invalidated by the following uses of that basic_string object:

    • as an argument to any standard library function taking a reference to non-const basic_string as an argument.(footnote 230)

    • Calling non-const member functions, except operator[], at, data, front, back, begin, rbegin, end, and rend.