std::meta::is_pointer_type
From cppreference.com
| 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
Run this code
#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
(C++26) |
checks if reflection represents a member pointer type (function) |
| 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 an array type (function) |
(C++26) |
checks if reflected type is a scalar type (function) |
(C++11) |
checks if a type is a pointer type (class template) |
(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 an array type (class template) |
(C++11) |
checks if a type is a scalar type (class template) |