if(typeid(int) == typeid(const int)) cout << "Same types"<< endl;
PROGRAM OUTPUT:
Same types
am I missing something? these are not same types lol.
They aren't the same type, but the typeid operator strips const and volatile.
typeid
const
volatile
From section 5.2.8 [expr.typeid]:
[expr.typeid]
The top-level cv-qualifiers of the glvalue expression or the type-id that is the operand of typeid are always ignored.
1.4m articles
1.4m replys
5 comments
57.0k users