cout << typeid(int&).name();
This, in my opinion, should return int& as a type, not an int, but on GCC 4.5.1 and on VS2010 SP1 beta it returns int. Why is this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is how typeid is supposed to work. When you apply
typeidto a type-id of a reference type, thetype_infoobject refers to the referenced type.ISO/IEC 14882:2003, 5.2.8 / 4 [expr.typeid]: