c++ - why typeid returns that int and const int are same types -
c++ - why typeid returns that int and const int are same types -
if(typeid(int) == typeid(const int)) cout << "same types"<< endl;
program output:
same types
am missing something? these not same types lol.
they aren't same type, typeid operator strips const , volatile.
from section 5.2.8 [expr.typeid]:
the top-level cv-qualifiers of glvalue look or type-id operand of typeid ignored.
c++ typeid
Comments
Post a Comment