Title
array::iterator and array::const_iterator should be literal types
Status
resolved
Section
[array.overview]
Submitter
Russia

Created on 2017-02-03.00:00:00 last changed 79 months ago

Messages

Date: 2018-06-12.02:06:47

Proposed resolution:

This wording is relative to N4659.

  1. Add a new paragraph at the end of [iterator.requirements.general] as indicated:

    -12- An invalid iterator is an iterator that may be singular.(footnote: […])

    Iterators are called constexpr iterators if all defined iterator category operations, except a pseudo-destructor call ([expr.pseudo]) or the construction of an iterator with a singular value, are usable as constant expressions. [Note: For example, the types "pointer to int" and reverse_iterator<int*> are constexpr random access iterators. — end note]

    -13- In the following sections, a and b denote […]

  2. Add a new paragraph at the end of [array.overview]:

    -3- An array satisfies all of the requirements of a container […]

    -?- iterator and const_iterator satisfy the constexpr iterator requirements ([iterator.requirements.general]).

Date: 2018-06-12.02:06:47

[ 2018-06 Rapperswil Wednesday issues processing ]

This was resolved by P0858, which was adopted in Jacksonville.

Date: 2017-11-13.19:00:40

[ 2017-11 Albuquerque Saturday issues processing ]

P0858R0 (adopted on Sat; to be moved in Jacksonville) will resolve this.

Date: 2017-11-10.03:05:33

[ 2017-11 Albuquerque Thursday ]

It looks like 1581 is going to be resolved this week, so we should revisit soon.

Date: 2017-11-10.03:05:33

[ 2017-11 Albuquerque Wednesday issue processing ]

Status to Open; We don't want to do this yet; gated on Core issue 1581 (affects swap). See also 2800.

Thomas to talk to Anthony about writing a paper detailing what it takes to be a constexpr iterator.

Date: 2017-04-15.00:00:00

[ 2017-04-22, Antony Polukhin provides improved wording ]

Date: 2017-03-15.00:00:00

[ 2017-03-04, Kona ]

Set priority to 2. Lisa and Alisdair to work with Antony to come up with better wording. The same wording can be used for 2938.

Previous resolution [SUPERSEDED]:

This wording is relative to N4640.

  1. Add a new paragraph at the end of [array.overview]:

    -3- An array satisfies all of the requirements of a container […]

    -?- All operations on iterator and const_iterator that are required to satisfy the random access iterator requirements are usable in constant expressions.

Date: 2017-03-15.00:00:00

[ 2017-03-02, Tim Song comments ]

I don't believe the blanket "all operations" wording is quite correct.

First, T t; (required by DefaultConstructible) isn't usable in a constant expression if the iterator is a pointer, since it would leave it uninitialized.

Second, an explicit destructor call u.~T() (required by Destructible) isn't usable if the iterator is a class type because it explicitly invokes a non-constexpr function (the destructor); see [expr.const]/2.2.

Date: 2017-03-15.00:00:00

[ 2017-03-02, Kona ]

Wording tweaks suggested by LWG applied.

Date: 2017-03-15.00:00:00

[ 2017-03-01, Kona ]

Antony Polukhin provides revised wording.

Date: 2017-02-20.00:00:00

[ 2017-02-20 Marshall adds wording ]

I used the formulation "are literal types", rather than "shall be", since that denotes a requirement on the user.

Previous resolution [SUPERSEDED]:

This wording is relative to N4640.

  1. Add a new paragraph at the end of [array.overview]:

    -?- iterator and const_iterator are literal types.
Date: 2017-02-03.00:00:00
Addresses RU 3

Force the literal type requirement for the iterator and const_iterator in the std::array so that iterators of std::array could be used in constexpr functions.

Proposed change: Add to the end of the [array.overview] section: iterator and const_iterator shall be literal types.

History
Date User Action Args
2018-06-12 02:06:47adminsetmessages: + msg9902
2018-06-12 02:06:47adminsetstatus: open -> resolved
2017-11-13 19:00:40adminsetmessages: + msg9553
2017-11-10 03:05:33adminsetmessages: + msg9537
2017-11-10 03:05:33adminsetmessages: + msg9536
2017-11-10 03:05:33adminsetstatus: new -> open
2017-04-24 11:58:06adminsetmessages: + msg9165
2017-03-14 03:14:09adminsetmessages: + msg9112
2017-03-02 18:49:03adminsetmessages: + msg9040
2017-03-02 17:41:20adminsetmessages: + msg9038
2017-03-01 17:21:08adminsetmessages: + msg9021
2017-02-20 18:11:16adminsetmessages: + msg8956
2017-02-20 18:11:16adminsetmessages: + msg8955
2017-02-03 00:00:00admincreate