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