std::basic_string
's iterator
and const_iterator
constexpr iterators?Section: 27.4.3.1 [basic.string.general] Status: C++23 Submitter: Jiang An Opened: 2021-12-04 Last modified: 2023-11-22
Priority: Not Prioritized
View all other issues in [basic.string.general].
View all issues with C++23 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.
iterator
and const_iterator
meet the constexpr
iterator requirements (24.3.1 [iterator.requirements.general])." to 27.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.
Modify 27.4.3.1 [basic.string.general], as indicated:
-3- In all cases,
-4- A[data(), data() + size()]
is a valid range,data() + size()
points at an object with valuecharT()
(a "null terminator"), andsize() <= capacity()
istrue
.size_type
parameter type in abasic_string
deduction guide refers to thesize_type
member type of the type deduced by the deduction guide. -?- The typesiterator
andconst_iterator
meet the constexpr iterator requirements (24.3.1 [iterator.requirements.general]).