close
Namespaces
Variants

std::meta::reflect_function

From cppreference.com
< cpp | meta
 
 
Metaprogramming library
Type traits
Type categories
(C++11)
(C++11)(DR*)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11) 
(C++11)
(C++11)
Type properties
(C++11)
(C++11)
(C++14)
(C++11)(deprecated in C++26)
(C++11)(until C++20*)
(C++11)(deprecated in C++20)
(C++11)
Type trait constants
Metafunctions
(C++17)
Supported operations
Relationships and property queries
Type modifications
(C++11)(C++11)(C++11)
Type transformations
(C++11)(deprecated in C++23)
(C++11)(deprecated in C++23)
(C++11)
(C++11)(until C++20*)(C++17)

(C++11)
(C++17)
Compile-time rational arithmetic
Compile-time integer sequences
 
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