string_view
iterators use old wordingSection: 27.3.3.4 [string.view.iterators] Status: C++17 Submitter: Alisdair Meredith Opened: 2016-11-17 Last modified: 2017-07-30
Priority: 0
View all issues with C++17 status.
Discussion:
The wording for basic_string_view
was written before the definition of
a contiguous iterator was added to C++17 to avoid repeating redundant
wording.
Suggested modification of 27.3.3.4 [string.view.iterators] p1 (stealing words from valarray begin
/end
):
-1-
A constant random-access iterator type such that, for aA type that meets the requirements of a constant random access iterator (24.2.7) and of a contiguous iterator (24.2.1) whoseconst_iterator it
, if&*(it + N)
is valid, then&*(it + N) == (&*it) + N
value_type
is the template parametercharT
.
[2017-01-27 Telecon]
Priority 0
Proposed resolution:
This wording is relative to N4606.
Modify 27.3.3.4 [string.view.iterators] as indicated:
using const_iterator = implementation-defined;-1- A
-2- For aconstant random-access iterator type such that, for atype that meets the requirements of a constant random access iterator (24.3.5.7 [random.access.iterators]) and of a contiguous iterator (24.3.1 [iterator.requirements.general]) whoseconst_iterator it
, if&*(it + N)
is valid, then&*(it + N) == (&*it) + N
value_type
is the template parametercharT
.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 fromstr
's methods. -3- All requirements on container iterators (23.2 [container.requirements]) apply tobasic_string_view::const_iterator
as well.