std::meta::reflect_constant
From cppreference.com
| Defined in header <meta>
|
||
template< class T >
consteval std::meta::info reflect_constant( T expr );
|
(since C++26) | |
Returns a reflection that represents either the value of expr (if T is a ScalarType) or the template parameter object with value expr (if T is a class type).
Formally, let:
Vbe:
- if
Tis a class type, then an object that is template-argument-equivalent to the value ofexpr; - otherwise, the value of
expr;
- if
TClsbe the invented templatetemplate<T P> struct TCls;
This function returns std::meta::template_arguments_of(^^TCls<V>)[0].
The program is ill-formed if std::is_copy_constructible_v<T> is false, if T is not a cv-unqualified structural type, or if T is a reference type.
Parameters
| expr | - | a value of a structural type |
Return value
A reflection as described above.
Exceptions
Throws std::meta::exception if TCls<V> is invalid.
Example
| This section is incomplete Reason: no example |
See also
(C++26) |
promotes a compile-time string to static storage, returning a reflection representing the static string (function template) |
(C++26) |
promotes compile-time array into static storage, returning a reflection representing the static array (function template) |
(C++26) |
returns a reflection representing an object, suitable for use as a constant template argument (function template) |
(C++26) |
returns a reflection representing a function, suitable for use as a constant template argument (function template) |
(C++26) |
obtains a reflection of the result of substituting reflected arguments in the reflected template (function template) |