判断是否为指针类型, 包含函数指针
#include <iostream>
#include <memory>
#include <memory.h>
#include <type_traits>
void void_print()
{
return;
}
typedef void(*void_func_ptr)();
int main()
{
std::cout << "This Demo: is_pointer" << std::endl;
int a = 10;
int b[3] = {10, 11, 12};
int c[] = {10, 11, 12};
int* d = new int[3];
memset(d, 0, sizeof(int) * 3);
if(std::is_pointer<decltype (a)>::value)
{
std::cout << __LINE__ << ": is pointer type" << std::endl;
}
else
{
std::cout << __LINE__ << ": isn't pointer type" << std::endl;
}
if(std::is_pointer<decltype (b)>::value)
{
std::cout << __LINE__ << ": is pointer type" << std::endl;
}
else
{
std::cout << __LINE__ << ": isn't pointer type&#