Namespaces
Variants

std::meta::reflect_constant

From cppreference.com
< cpp | meta
 
 
 
Reflection library
 
Reflection types and queries
Reflection queries
Reflection layout queries
Type properties
Type property queries
 
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:

  • V be:
  • TCls be the invented template template<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

See also

promotes a compile-time string to static storage, returning a reflection representing the static string
(function template) [edit]
promotes compile-time array into static storage, returning a reflection representing the static array
(function template) [edit]
returns a reflection representing an object, suitable for use as a constant template argument
(function template) [edit]
returns a reflection representing a function, suitable for use as a constant template argument
(function template) [edit]
obtains a reflection of the result of substituting reflected arguments in the reflected template
(function template) [edit]