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) |
reflection names and locations | |
reflection queries | |
(C++26) |
checks if reflection is a complete type (function) |
(C++26) |
checks if reflection is a variable (function) |
(C++26) |
checks if reflection is a type (function) |
(C++26) |
checks if reflection is a namespace (function) |
(C++26) |
checks if reflection is a type alias (function) |
(C++26) |
checks if reflection is a namespace alias (function) |
(C++26) |
checks if reflection is a function (function) |
(C++26) |
checks if reflection is a function parameter (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 | |