std::meta::constant_of
From cppreference.com
| Defined in header <meta>
|
||
constexpr std::meta::info constant_of( std::meta::info r );
|
(since C++26) | |
Returns a reflection of the (constant) value of what r represents.
Formally:
- If
rrepresents an annotation, returns its underlying constant (std::meta::reflect_constant(expr)whereexpris the annotation's constant expression). - Otherwise, let
Rbe a constant expression equal tor:
- If
rrepresents a variable or object of array type, returnsstd::meta::reflect_constant_array([:R:]). - Otherwise, if
rrepresents a function, returnsstd::meta::reflect_function([:R:]). - Otherwise, returns
std::meta::reflect_constant([:R:]).
- If
Parameters
| r | - | a reflection value |
Return value
A reflection of the value of what r represents.
Exceptions
Throws std::meta::exception unless either r represents an annotation or [:R:] is a valid splice expression.
Notes
The result represents a function if r represents a function, a template parameter object if r represents a variable or object of array or class type, or a (scalar) value if r represents a variable or object of scalar type.
Example
| This section is incomplete Reason: no example |
See also
(C++26) |
returns a reflection representing a value or template parameter object, suitable for use as a constant template argument (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 a function, suitable for use as a constant template argument (function template) |