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

3650. Are std::basic_string's iterator and const_iterator constexpr iterators?

Section: 23.4.3.1 [basic.string.general] Status: WP Submitter: Jiang An Opened: 2021-12-04 Last modified: 2022-02-10

Priority: Not Prioritized

View all issues with WP status.

Discussion:

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 (25.3.1 [iterator.requirements.general])." to 23.4.3.1 [basic.string.general].

[2022-01-30; Reflector poll]

Set status to Tentatively Ready after six votes in favour during reflector poll.

[2022-02-10 Approved at February 2022 virtual plenary. Status changed: Tentatively Ready → WP.]

Proposed resolution:

This wording is relative to N4901.

  1. Modify 23.4.3.1 [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 (25.3.1 [iterator.requirements.general]).