Title
Clarify what `meta::reflect_constant_string` considers a string literal
Status
wp
Section
[meta.reflection.array]
Submitter
Jakub Jelinek

Created on 2025-10-21.00:00:00 last changed 1 month ago

Messages

Date: 2025-11-11.10:48:16

Proposed resolution:

This wording is relative to N5014.

  1. Modify [meta.reflection.array] as indicated:

    template<ranges::input_range R>
      consteval info reflect_constant_string(R&& r);
    

    -2- Let `CharT` be ranges::range_value_t<R>.

    -3- Mandates: `CharT` is one of `char`, `wchar_t`, `char8_t`, `char16_t`, `char32_t`.

    Let V be the pack of values of type `CharT` whose elements are the corresponding elements of `r`, except that if `r` refers is a reference to a string literal object, then V does not include the trailing null terminator terminating u+0000 null character of `r`.

Date: 2025-11-11.10:48:16

[ Kona 2025-11-08; Status changed: Voting → WP. ]

Date: 2025-10-15.00:00:00

[ 2025-10-23; Reflector poll. ]

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

Date: 2025-10-21.00:00:00

`meta::reflect_constant_string` says:

Let V be the pack of values of type `CharT` whose elements are the corresponding elements of `r`, except that if `r` refers to a string literal object, then V does not include the trailing null terminator of `r`.
It's unclear how the implementation should decide whether `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 [basic.string.general] and not used for string literal objects ([lex.string]).

History
Date User Action Args
2025-11-11 10:48:16adminsetmessages: + msg15661
2025-11-11 10:48:16adminsetstatus: voting -> wp
2025-10-30 17:45:31adminsetstatus: ready -> voting
2025-10-27 10:00:32adminsetmessages: + msg15457
2025-10-27 10:00:32adminsetstatus: new -> ready
2025-10-21 12:18:32adminsetmessages: + msg15303
2025-10-21 00:00:00admincreate