std::meta::type_of
From cppreference.com
| Defined in header <meta>
|
||
consteval std::meta::info type_of( std::meta::info r );
|
(since C++26) | |
Returns a reflection representing the type of what r represents.
Formally:
- If
rrepresents a function parameter (see std::meta::parameters_of), returns a reflection of the corresponding type in the parameter-type-list of the function. - If
rrepresents a value, object, variable, function, non-static data member, or unnamed bit-field, returns a reflection of the type of whatrrepresents. - If
rrepresents an annotation, returnsstd::meta::type_of(std::meta::constant_of(r)). - If
rrepresents an enumerator of an enumeration type E :
- if
type_ofis called after E 's definition, returns a reflection of E ; - otherwise (
type_ofis called within E 's definition), returns a reflection of an integer type (which is the type of the enumerator within the enumeration definition).
- if
- If
rrepresents a direct base class relationship (i.e. an element ofstd::meta::bases_of(x, ctx)), returns a reflection of the base class in the relationship. - If
rrepresents a data member description (i.e. a value returned by std::meta::data_member_spec), returns a reflection of the type in the description.
Parameters
| r | - | a reflection of something that has a type |
Return value
The type of what r represents.
Exceptions
Throws std::meta::exception unless what r represents has a type. That is, r must represent one of:
- value
- annotation
- object
- variable
- function whose type does not contain an undeduced placeholder type and that is not a constructor or destructor
- enumerator
- non-static data member
- unnamed bit-field
- direct base class relationship
- data member description
- function parameter
Example
| This section is incomplete Reason: no example |
See also
| This section is incomplete |