Title
Are std::basic_string's iterator and const_iterator constexpr iterators?
Status
new
Section
[basic.string.general]
Submitter
Jiang An

Created on 2021-12-04.00:00:00 last changed 1 month ago

Messages

Date: 2021-12-04.15:14:52

Proposed resolution:

This wording is relative to N4901.

  1. Modify [basic.string.general], as indicated:

    -3- In all cases, [data(), data() + size()] is a valid range, data() + size() points at an object with value charT() (a "null terminator"), and size() <= capacity() is true.

    -4- A size_type parameter type in a basic_string deduction guide refers to the size_type member type of the type deduced by the deduction guide.

    -?- The types iterator and const_iterator meet the constexpr iterator requirements ([iterator.requirements.general]).

Date: 2021-12-04.00:00:00

std::vector's iterator and const_iterator are required to meet constexpr iterator requirements in C++20 per P1004R2, but it seems that the similar wording is missing for std::basic_string in both P0980R1 and the current working draft.

I think we should add a bullet "The types iterator and const_iterator meet the constexpr iterator requirements ([iterator.requirements.general])." to [basic.string.general].

History
Date User Action Args
2021-12-04 15:14:52adminsetmessages: + msg12251
2021-12-04 00:00:00admincreate