std::meta::reflect_constant_array
| Defined in header <meta>
|
||
template< ranges::input_range R >
consteval std::meta::info reflect_constant_array( R&& r );
|
(since C++26) | |
Returns a reflection that represents an array object whose elements are corresponding elements of r.
Let T be ranges::range_value_t<R>.
The program is ill-formed if T is not a structural type, if std::is_constructible_v<T, ranges::range_reference_t<R>> is false, or if T does not satisfy copy_constructible.
Parameters
| r | - | an input_range
|
Return value
If the size of r is not zero, a reflection that represents a template parameter object of type const T[N] (where N is the size of r). Each element of the template parameter object is initialized from the value or object represented by std::meta::reflect_constant(static_cast<T>(*it)), where it is an iterator to the corresponding element of r.
Otherwise (the size of r is zero), a reflection that represents the template parameter object of type const std::array<T, 0> initialized with {}.
Exceptions
Throws any exception thrown by the evaluation of static_cast<T>(*it), or std::meta::exception if the evaluation of std::reflect_constant would exit via an exception.
Notes
As a template parameter object, the resulting object has static storage duration. Ranges with template-argument-equivalent contents correspond to the same object.
The resulting object is a potentially non-unique object.
The result of std::meta::reflect_constant_array is suitable for use with std::meta::substitute. If the caller wants a span of a static array, as opposite to a reflection value, std::define_static_array is usually more suitable.
Example
| This section is incomplete Reason: no example |
See also
(C++26) |
promotes compile-time array into static storage, returning a span of the static array (function template) |
(C++26) |
promotes a compile-time string to static storage, returning a reflection representing the static string (function template) |
(C++26) |
returns a reflection representing a value or object, suitable for use as a constant template argument (function template) |