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

3102. Clarify span iterator and const_iterator behavior

Section: 26.7.3.1 [span.overview] Status: WP Submitter: Stephan T. Lavavej Opened: 2018-04-12 Last modified: 2018-06-11

Priority: 0

View all issues with WP status.

Discussion:

There are multiple issues with how span specifies its iterators:

By imitating 24.4.2.2 [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.

  1. Edit 26.7.3.1 [span.overview] as indicated:

    -4- The iterator types for span is a random access iterator and a contiguous iteratorspan::iterator and span::const_iterator are random access iterators (27.2.7 [random.access.iterators]), contiguous iterators (27.2.1 [iterator.requirements.general]), and constexpr iterators (27.2.1 [iterator.requirements.general]). All requirements on container iterators (26.2 [container.requirements]) apply to span::iterator and span::const_iterator as well.