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.
meta::reflect_constant_string considers a string literalSection: 21.4.15 [meta.reflection.array] Status: WP Submitter: Jakub Jelinek Opened: 2025-10-21 Last modified: 2025-11-11
Priority: Not Prioritized
View all issues with WP status.
Discussion:
meta::reflect_constant_string says:
Let V be the pack of values of typeIt's unclear how the implementation should decide whetherCharTwhose elements are the corresponding elements ofr, except that ifrrefers to a string literal object, then V does not include the trailing null terminator ofr.
r refers to
a string literal. If R models contiguous_iterator, should it use
meta::is_string_literal(ranges::data(r))?
Should it omit the '\0' from string_view("abc", 3)?
Also, "null terminator" is only defined in 27.4.3.1 [basic.string.general] and not used for string literal objects (5.13.5 [lex.string]).
[2025-10-23; Reflector poll.]
Set status to Tentatively Ready after six votes in favour during reflector poll.
[Kona 2025-11-08; Status changed: Voting → WP.]
Proposed resolution:
This wording is relative to N5014.
Modify 21.4.15 [meta.reflection.array] as indicated:
template<ranges::input_range R> consteval info reflect_constant_string(R&& r);-2- Let
CharTberanges::range_value_t<R>.-3- Mandates:
CharTis one ofchar,wchar_t,char8_t,char16_t,char32_t.Let V be the pack of values of type
CharTwhose elements are the corresponding elements ofr, except that ifrrefersis a reference to a string literal object, then V does not include thetrailing null terminatorterminating u+0000 null character ofr.