Files
2025-10-25 03:02:53 +03:00

4.1 KiB
Raw Permalink Blame History

[meta.reflection.array]

21 Metaprogramming library [meta]

21.4 Reflection [meta.reflection]

21.4.15 Promoting to static storage arrays [meta.reflection.array]

1

#

The functions in this subclause promote compile-time storage into static storage.

🔗

template<ranges::[input_range](range.refinements#concept:input_range "25.4.6Other range refinements[range.refinements]") R> consteval info reflect_constant_string(R&& r);

2

#

Let CharT be ranges::range_value_t.

3

#

Mandates: CharT is one ofchar,wchar_t,char8_t,char16_t,char32_t.

4

#

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.

5

#

Let P be the template parameter object ([temp.param]) of type const CharT[sizeof...(V) + 1] initialized with {V..., CharT()}.

6

#

Returns: ^^P.

7

#

[Note 1:

P is a potentially non-unique object ([intro.object]).

— end note]

🔗

template<ranges::[input_range](range.refinements#concept:input_range "25.4.6Other range refinements[range.refinements]") R> consteval info reflect_constant_array(R&& r);

8

#

Let T be ranges::range_value_t.

9

#

Mandates: T is a structural type ([temp.param]),is_constructible_v<T, ranges::range_reference_t> is true, andis_copy_constructible_v is true.

10

#

Let V be the pack of values of type info of the same size as r, where the ith element is reflect_constant(ei), where ei is the ith element of r.

11

#

Let P be

  • (11.1)

    If sizeof...(V) > 0 is true, then the template parameter object ([temp.param]) of type const T[sizeof...(V)] initialized with {[:V:]...}.

  • (11.2)

    Otherwise, the template parameter object of type array<T, 0> initialized with {}.

12

#

Returns: ^^P.

13

#

Throws: meta::exception unlessreflect_constant(e) is a constant subexpression for every element e of r.

14

#

[Note 2:

P is a potentially non-unique object ([intro.object]).

— end note]