This:
cout << std::is_const<const int*>::value;
prints out false and I’d think that it should print true. Why does it print false?
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.
As others have mentioned, what you have is a non-const pointer to a
const int. You are asking if the pointer is const, and it isn’t, it can be changed. It just points to something which is const. If you want to know if the pointed-to type is const, something like this should work: