std::meta::members_of
| Defined in header <meta>
|
||
consteval std::vector<std::meta::info>
members_of( std::meta::info r, std::meta::access_context ctx );
|
(since C++26) | |
Returns a std::vector containing the reflections of the members of the class type or namespace represented by r, filtered by the access context ctx.
Each reflection m in the result represents an accessible member that has an eligible declaration and is representable (see below). Accessibility is determined as if by std::meta::is_accessible(m, ctx).
Let Q be the class type or namespace represented by r.
A declaration is eligible if it meets all the following requirements:
- It is in the scope of
Q. (A block-scope function declaration is not eligible, for example.) - It is not a friend declaration.
- It is not the declaration of a closure type.
- It is not the declaration of a (partial or full) template specialization.
- If
Qis a class type that is not a closure type, the declaration introduces a direct member ofQthat is not a variant member of a nested anonymous union ofQ. - If
Qis a closure type, the declaration introduces a function call operator or function call operator template.
It is implementation-defined whether declarations of other members of a closure type Q are eligible.
Only declarations before the members_of call are considered.
A member is representable if it is one of the following:
- a class or enumeration type
- a type alias
- a class template, function template, variable template, alias template, or concept
- a variable or reference whose type does not contain an undeduced placeholder type
- a function
Ffor which:
- the type of
Fdoes not contain an undeduced placeholder type; - the constraints (if any) of
Fare satisfied; and - if
Fis a prospective destructor, it is the selected destructor
- the type of
- a data member
- a namespace
- a namespace alias
This function treats unnamed bit-fields declared in the scope of Q as data members with the same access.
Reflections of class members and unnamed bit-fields appear in the order in which they are declared. Implicitly-declared special members appear after any user-defined members.
Parameters
| r | - | a reflection of complete class type or namespace |
| ctx | - | an access context |
Return value
A std::vector of reflection values that represents class members or namespace members.
Exceptions
Throws std::meta::exception unless std::meta::dealias(r) represents either a class type complete from some point in the evaluation context, or a namespace.
Example
| This section is incomplete Reason: no example |
See also
(C++26) |
obtains the accessible direct bases of the reflected class (function) |