This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++17 status.

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

Section: 21.3.3.2 [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:

21.3.3.2 [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 21.3.3.2 [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`.