#include <iostream>
#include<cstring>
#include <typeinfo>
using namespace std;
int main()
{
int a = 10;
double *p;
wchar_t *pstr;
cout << typeid(a).name() << endl;
cout << typeid(p).name() << endl;
cout << typeid(pstr).name() << endl;
cout << typeid( typeid(p).name()).name() << endl;
int *px;
int *py;
if (strcmp(typeid(px).name(),typeid(py).name())==0)
{
cout << "相等";
}
else
{
cout << "bu相等";
}
return 0;
}
xin@xin-virtual-machine:~/c++/template$ ./all
i
Pd
Pw
PKc
相等xin@xin-virtual-machine:~/c++/template$ c++filt -t Pd
double*
xin@xin-virtual-machine:~/c++/template$ c++filt -t Pw
wchar_t*
xin@xin-virtual-machine:~/c++/template$ c++filt -t PKc
char const*
P表示指针类型
K表示常量
w wchar_t
c char
d double