Namespaces
Variants

std::meta::current_function

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

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

Let S be std::meta::access_context::current().scope(), effectively returns S, except that the result is restricted to reflections of functions.

Return value

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

Exceptions

Throws std::meta::exception unless S represents a function.

Notes

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 call operator of 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]