Namespaces
Variants

std::meta::constant_of

From cppreference.com
< cpp | meta
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 r represents an annotation, returns its underlying constant (std::meta::reflect_constant(expr) where expr is the annotation's constant expression).
  • Otherwise, let R be a constant expression equal to r:
  • If r represents a variable or object of array type, returns std::meta::reflect_constant_array([:R:]).
  • Otherwise, if r represents a function, returns std::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

returns a reflection representing a value or template parameter object, suitable for use as a constant template argument
(function template) [edit]
promotes compile-time array into static storage, returning a reflection representing the static array
(function template) [edit]
returns a reflection representing a function, suitable for use as a constant template argument
(function template) [edit]