std::meta::is_member_function_pointer_type
From cppreference.com
| Defined in header <meta>
|
||
consteval bool is_member_function_pointer_type( std::meta::info r );
|
(since C++26) | |
Returns true if r represents a type that is a pointer to a non-static member function. Otherwise returns false.
Parameters
| r | - | a reflection value |
Return value
true if r represents a member function pointer type; otherwise false.
Exceptions
Throws std::meta::exception if r does not represent a type or type alias.
Example
Run this code
#include <meta>
struct A
{
int m;
inline static int n{};
void f() {}
static void g();
};
int main()
{
int A::*mem_data_ptr = &A::m; // a pointer to member data
int* data_ptr = &A::n; // a pointer to static member data
void (A::*mem_fun_ptr)() = &A::f; // a pointer to member function
void (*fun_ptr)() = &A::g; // a pointer to static member function
static_assert
(""
&& is_member_function_pointer_type(^^decltype(mem_fun_ptr))
&& ! is_member_function_pointer_type(^^decltype(fun_ptr))
&& ! is_member_function_pointer_type(^^decltype(mem_data_ptr))
&& ! is_member_function_pointer_type(^^decltype(data_ptr))
&& ! is_member_function_pointer_type(^^int (*)())
&& ! is_member_function_pointer_type(^^A const* volatile)
);
}
See also
(C++26) |
checks if reflection represents a member pointer type (function) |
| checks if reflection represents a member object pointer type (function) | |
(C++26) |
checks if reflected type is a pointer type (function) |
(C++11) |
checks if a type is a pointer to a non-static member function or object (class template) |
(C++11) |
checks if a type is a non-static member object pointer (class template) |
(C++11) |
checks if a type is a non-static member function pointer (class template) |
(C++11) |
checks if a type is a pointer type (class template) |