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

delphi - blogger via idHTTP : error 400 bad request -

c++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter -

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