if(typeid(int) == typeid(const int))
cout << \"Same types\"<< endl;
PROGRAM OUTPUT:
Same
You probably want this instead:
#include <type_traits>
if (std::is_same<int, const int>::value)
std::cout << "same types\n";
else
std::cout << "different types\n";
They aren't the same type, but the typeid operator strips const and volatile.
From section 5.2.8 [expr.typeid]:
The top-level cv-qualifiers of the glvalue expression or the type-id that is the operand of
typeidare always ignored.