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

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -