This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.
3102. Clarifyspan iterator
and const_iterator
behavior
Section: 23.7.2.2.1 [span.overview] Status: C++20 Submitter: Stephan T. Lavavej Opened: 2018-04-12 Last modified: 2021-02-25
Priority: 0
View all other issues in [span.overview].
View all issues with C++20 status.
Discussion:
There are multiple issues with how span specifies its iterators:
const_iterator
isn't mentioned.
The relationship between iterator
and const_iterator
isn't specified. (span
isn't a container, so it doesn't receive this automatically.)
The iterators should be specified to be constexpr.
By imitating 27.3.3.4 [string.view.iterators]/3 "All requirements on container iterators ([container.requirements]) apply to basic_string_view::const_iterator
as well.", we can specify that iterator
is convertible to const_iterator
.
[ 2018-04-23 Moved to Tentatively Ready after 6 positive votes on c++std-lib. ]
[2018-06 Rapperswil: Adopted]
Proposed resolution:
This wording is relative to N4741.
Edit 23.7.2.2.1 [span.overview] as indicated:
-4- The iterator type s for span is a random access iterator and a contiguous iterator
span::iterator
andspan::const_iterator
are random access iterators (24.3.5.7 [random.access.iterators]), contiguous iterators (24.3.1 [iterator.requirements.general]), and constexpr iterators (24.3.1 [iterator.requirements.general]). All requirements on container iterators (23.2 [container.requirements]) apply tospan::iterator
andspan::const_iterator
as well.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4