Spec-Zone.ru › C++

std::meta::reflect_function

Defined in header <meta>
template< class T >
consteval std::meta::info reflect_function( T& fn );
(since C++26)

Returns a reflection that represents the function referred to by fn.

The program is ill-formed if T is not a function type.

Parameters

r - an lvalue that refers to a function

Return value

A reflection that represents a function.

Exceptions

Throws std::meta::exception unless a glvalue constant expression E that refers to the function fn is a valid template argument for a template parameter of type T&.

Notes

This function can be used to create a reflection of a function whose name is overloaded.

int f(char); // #1
int f(long); // #2

constexpr auto rf1 = ^^f; // error: cannot reflect an overload set
constexpr auto rf2 = std::meta::reflect_function<int(char)>(f); // OK, rf2 represents overload #1

Example

See also

reflect_constant
(C++26)
returns a reflection representing a value or template parameter object, suitable for use as a constant template argument
(function template)
reflect_object
(C++26)
returns a reflection representing an object, suitable for use as a constant template argument
(function template)
substitute
(C++26)
substitutes reflected arguments in the reflected template
(function template)

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/meta/reflect_function

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API