Namespaces
Variants

std::meta::current_class

From cppreference.com
< cpp | meta
Defined in header <meta>
consteval std::meta::info current_class();
(since C++26)

Returns a reflection of the class whose scope is the smallest class scope that encloses the call site.

Let S be std::meta::access_context::current().scope(), effectively returns S if it represents a class type, or std::meta::parent_of(S) if S represents a member function.

Return value

A reflection that represents the class type whose scope encloses the call site, as described above.

Exceptions

Throws std::meta::exception unless S represents either a class type or a member function.

Notes

The result may represent a union type.

If this function is used in a default member initializer or default argument, the call site is considered to be the point that uses the initializer or default argument (not where the call lexically appears).

If this function is called in the body of a lambda expression, the result represents the lambda's closure type.

Example

See also

[static]
constructs a std::meta::access_context associated with the scope of the call site
(public static member function of std::meta::access_context) [edit]