std::meta::constant_of
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:]).
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
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) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/meta/constant_of