std::meta::is_pointer_type - cppreference.com
Namespaces
Variants

std::meta::is_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_pointer_type( std::meta::info r );
(since C++26)

Returns true if r represents a pointer to object or function (including pointer to void, but excluding pointer to member) or a cv-qualified version thereof. Otherwise returns false.

Parameters

r - a reflection value

Return value

true if r represents a 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;
    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_pointer_type(^^A)
        &&   is_pointer_type(^^A*)
        &&   is_pointer_type(^^A const* volatile)
        && ! is_pointer_type(^^A&)
        && ! is_pointer_type(^^decltype(mem_data_ptr))
        && ! is_pointer_type(^^decltype(mem_fun_ptr))
        &&   is_pointer_type(^^void*)
        && ! is_pointer_type(^^int)
        &&   is_pointer_type(^^int*)
        &&   is_pointer_type(^^int**)
        && ! is_pointer_type(^^int[10])
        && ! is_pointer_type(^^std::nullptr_t)
        &&   is_pointer_type(^^void (*)())
    );
}

See also