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

3110. Contiguous Iterators should always be Random-Access

Section: 25.3.1 [iterator.requirements.general] Status: Resolved Submitter: Marc Aldorasi Opened: 2018-05-07 Last modified: 2020-09-06

Priority: 3

View all other issues in [iterator.requirements.general].

View all issues with Resolved status.

Discussion:

In [iterator.requirements.general] paragraph 6, contiguous iterators are defined in terms of general iterators, not random-access iterators. Since the defining expressions require random-access and the original paper's introduction describes contiguous iterators as a refinement of random-access iterators, contiguous iterators should be defined in terms of random-access iterators.

[2018-06-18 after reflector discussion]

Priority set to 3

Previous resolution [SUPERSEDED]:

This wording is relative to N4741.

  1. Edit 25.3.1 [iterator.requirements.general] as indicated:

    -6- Random-access iIterators that further satisfy the requirement that, for integral values n and dereferenceable iterator values a and (a + n), *(a + n) is equivalent to *(addressof(*a) + n), are called contiguous iterators. [Note: For example, the type "pointer to int" is a contiguous iterator, but reverse_iterator<int *> is not. For a valid iterator range [a, b) with dereferenceable a, the corresponding range denoted by pointers is [addressof(*a), addressof(*a) + (b - a)); b might not be dereferenceable. — end note]

[2020-05-03 Reflector discussion]

Resolved by P0894R4.

Rationale:

Resolved by P0894R4

Proposed resolution: