#include <iostream>
using namespace std;
int main()
{
cout << typeid(int).name() << endl;
cout << typeid(int&).name() << endl;
cout << typeid(int&&).name() << endl;
cout << typeid(const int).name() << endl;
cout << typeid(const int&).name() << endl;
cout << typeid(const int&&).name() << endl;
}
I think the output should be:
int
int&
int&&
const int
const int&
const int&&
However, the real output is:
int
int
int
int
int
int
Both of clang & vc++ do the same way.
Is there a reliable way to check the exact type name (with cv-ref-pointer traits) in C++?