3457. *this is not invalidated

Section: 27.3.3 [string.view.template] Status: New Submitter: Johel Ernesto Guerrero Peña Opened: 2020-06-26 Last modified: 2020-09-06

Priority: 3

View all other issues in [string.view.template].

View all issues with New status.

Discussion:

27.3.3 [string.view.template] states:

For a basic_string_view str, any operation that invalidates a pointer in the range [str.data(), str.data() + str.size()) invalidates pointers, iterators, and references returned from str's member functions.

The assignment operators return a reference to *this, but *this is not invalidated.

Previous resolution [SUPERSEDED]:

This wording is relative to N4861.

  1. Modify 27.3.3 [string.view.template] as indicated:

    -2- For a basic_string_view str, any operation that invalidates a pointer in the range [str.data(), str.data() + str.size()) invalidates pointers, iterators, and references to the elements in that range and its past-the-end iterator returned from str's member functions.

[2020-06-29; Casey comments and provides alternative proposed wording]

I think we should additionally strike "returned from str's member functions" from the end of the sentence. Provenance shouldn't affect invalidation; ranges::next(some_string_view.begin(), 42), for example, returns an iterator that denotes an element of some_string_view, but is not a member function of basic_string_view.

[2020-07-05; Reflector prioritization]

Set priority to 3 after reflector discussions.

Proposed resolution:

This wording is relative to N4861.

  1. Modify 27.3.3 [string.view.template] as indicated:

    -2- For a basic_string_view str, any operation that invalidates a pointer in the range [str.data(), str.data() + str.size()) invalidates pointers, iterators, and references to the elements in that range and its past-the-end iteratorreturned from str's member functions.