Title
Pre-increment on prvalues is not a requirement of weakly_incrementable
Status
c++20
Section
[iterator.concept.random.access]
Submitter
Eric Niebler

Created on 2019-09-09.00:00:00 last changed 23 months ago

Messages

Date: 2019-09-24.19:42:50

Proposed resolution:

This wording is relative to N4830.

  1. Modify [iterator.concept.random.access] as indicated:

    -2- Let a and b be valid iterators of type I such that b is reachable from a after n applications of ++a, let D be iter_difference_t<I>, and let n denote a value of type D. I models random_access_iterator only if

    1. (2.1) — (a += n) is equal to b.

    2. […]

    3. (2.6) — If (a + D(n - 1)) is valid, then (a + n) is equal to ++[](I c){ return ++c; }(a + D(n - 1)).

    4. […]

Date: 2019-09-24.00:00:00

[ 2019-09-24 Issue Prioritization ]

Status to Tentatively Ready and priority to 0 after six positive votes on the reflector.

Date: 2019-09-09.00:00:00

See [iterator.concept.random.access]/2.6, which shows ++ being applied to a prvalue iterator.

A similar change has already been made to [range.iota.view]/4.6.

Suggest priority P0 or P1 because it effects the definition of a concept.

History
Date User Action Args
2021-02-25 10:48:01adminsetstatus: wp -> c++20
2019-11-19 14:48:30adminsetstatus: voting -> wp
2019-10-07 02:48:00adminsetstatus: ready -> voting
2019-09-24 19:42:50adminsetmessages: + msg10670
2019-09-24 19:42:50adminsetstatus: new -> ready
2019-09-15 12:19:28adminsetmessages: + msg10625
2019-09-09 00:00:00admincreate