Reflection library (since C++26)
From cppreference.com
The facilities defined in this section support reflective programming, allowing C++ programs to both observe the structure of the program itself and to generate code that depends on those observations.
Core language
The reflection library works in conjunction with two core language features:
Reflection library
| This section is incomplete |
Defined in header
<meta> | |
(C++26) |
the type of reflection values (typedef) |
(C++26) |
exception thrown by reflection functions (class) |
promoting compile-time storage into static storage | |
(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) |
promotes compile-time string to static storage, returning a pointer to the first character of the static string (function template) |
(C++26) |
promotes compile-time array into static storage, returning a span of the static array (function template) |
(C++26) |
promotes compile-time value into static storage, returning a pointer to the static object (function template) |
operator representations | |
(C++26) |
identifies overloadable operators (enum) |
(C++26) |
identifies the operator represented by the reflection (function) |
(C++26) |
converts a meta::operators enumerator to its symbolic name (function) |
reflection names and locations | |
(C++26) |
checks if reflection represents an entity that has an identifier (function) |
(C++26) |
if the reflected entity has an identifier, obtains its name (function) |
| obtains a string suitable for identifying the reflected entity (function) | |
(C++26) |
obtains the source location of the reflected entity (function) |
reflection queries | |
| checks if the reflected entity has a storage duration (function) | |
(C++26) |
checks if the reflected entity has "C" language linkage (extern "C") (function) |
| checks if the reflected entity has a linkage (function) | |
(C++26) |
checks if reflection represents a complete type (function) |
(C++26) |
checks if the reflected type has its list of members completely defined (function) |
(C++26) |
checks if reflection represents a variable (function) |
(C++26) |
checks if reflection represents a type (function) |
(C++26) |
checks if reflection represents a namespace (function) |
(C++26) |
checks if reflection represents a type alias (function) |
(C++26) |
checks if reflection represents a namespace alias (function) |
(C++26) |
checks if reflection represents a function (function) |
(C++26) |
checks if reflection represents a function parameter (function) |
(C++26) |
checks if the reflected entity is contained in a scope (function) |
(C++26) |
obtains the scope that contains the reflected entity (function) |
accessibility queries | |
(C++26) |
represents a context for access checking (class) |
accessibility scope identification | |
reflection member queries | |
reflection layout queries | |
annotation reflection | |
value extraction | |
reflection substitution | |
(C++26) |
specifies a range of reflection values (concept) |
(C++26) |
checks whether the given arguments can be substituted in the given template (function template) |
(C++26) |
substitutes the given arguments in the given template, and returns a reflection of the result of substitution (function template) |
expression result reflection | |
(C++26) |
returns a reflection representing a value or template parameter object, suitable for use as a constant template argument (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) |
class definition generation | |
primary type categories | |
composite type categories | |
type properties | |
type property queries | |
type relations | |
const-volatile modifications | |
reference modifications | |
sign modifications | |
array modifications | |
pointer modifications | |
other transformations | |
checking string literals | |