Namespaces
Variants

std::meta::is_member_function_pointer_type

From cppreference.com
< cpp | meta
 
 
 
Reflection library
 
Reflection types and queries
Type properties
Type property queries
 
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

#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

checks if reflection represents a member pointer type
(function) [edit]
checks if reflection represents a member object pointer type
(function) [edit]
checks if reflected type is a pointer type
(function) [edit]
checks if a type is a pointer to a non-static member function or object
(class template) [edit]
checks if a type is a non-static member object pointer
(class template) [edit]
checks if a type is a non-static member function pointer
(class template) [edit]
checks if a type is a pointer type
(class template) [edit]
Morty Proxy This is a proxified and sanitized view of the page, visit original site.