std::meta::object_of
Defined in header <meta> | ||
|---|---|---|
consteval std::meta::info object_of( std::meta::info r ); | (since C++26) |
Given a reflection of variable, returns a reflection of the object referred to by the variable.
If r represents an object, returns r.
Parameters
| r | - | a reflection of variable or static object |
Return value
A reflection of the object referred to by what r represents.
Exceptions
Throws std::meta::exception unless r represents one of the following:
- an object with static storage duration;
- a variable of object type with static storage duration;
- a variable of reference type that refers to an object with static storage duration, and either:
- the reference is usable in a constant expression, or
- the lifetime of the reference began within the core constant expression currently under evaluation.
Example
#include <meta>
int x;
int& y = x;
// x and y are different variables:
static_assert(^^x != ^^y);
// x and y refer to the same object:
static_assert(std::meta::object_of(^^x) == std::meta::object_of(^^y));
int main() {}
See also
|
(C++26) | returns a reflection representing an object, suitable for use as a constant template argument (function template) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/meta/object_of