Title
The definition of constexpr iterators should be adjusted
Status
c++20
Section
[iterator.requirements.general]
Submitter
Daniel Krügler

Created on 2019-08-18.00:00:00 last changed 45 months ago

Messages

Date: 2019-09-14.12:23:37

Proposed resolution:

This wording is relative to N4830.

  1. Modify [iterator.requirements.general] as indicated:

    -16- Iterators are called constexpr iterators if all operations provided to meet iterator category requirements are constexpr functions., except for

    1. (16.1) — a pseudo-destructor call ([expr.prim.id.dtor]), and

    2. (16.2) — the construction of an iterator with a singular value.

Date: 2019-09-14.00:00:00

[ 2019-09-14 Issue Prioritization ]

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

Date: 2019-08-18.00:00:00

The current definition of constexpr iterators is specified in [iterator.requirements.general] p16 as follows:

Iterators are called constexpr iterators if all operations provided to meet iterator category requirements are constexpr functions, except for

  1. (16.1) — a pseudo-destructor call ([expr.prim.id.dtor]), and

  2. (16.2) — the construction of an iterator with a singular value.

With the acceptance of some proposals during the Cologne 2019 meeting, these additional requirements become mostly obsolete, as it had already been pointed out during that meeting:

With the acceptance of P0784R7, destructors can be declared constexpr and it is possible to perform a pseudo-destructor call within a constant expression, so bullet (16.1) is no longer a necessary requirement.

With the acceptance of P1331R2, trivial default initialization in constexpr contexts is now possible, and there is no longer a requirement to initialize all sub-objects of a class object within a constant expression.

It seems to me that we should simply strike the above two constraining requirements of the definition of constexpr iterators for C++20.

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-14 12:23:37adminsetmessages: + msg10608
2019-09-14 12:23:37adminsetstatus: new -> ready
2019-08-21 17:50:36adminsetmessages: + msg10571
2019-08-18 00:00:00admincreate