为什么 const 没有显示在 typeid().name() 的输出中,c++

Why const is not shown in the output by typeid().name(), c++

我是c++初学者

#include <iostream>
#include <typeinfo>

int main()
{
    const int i = 10;
    std::cout << typeid(i).name() << std::endl;
}

i的类型应该是const int,但为什么我的笔记本上结果是int?我正在使用 windows 10, Visual studio IDE.

i的类型确实是const int,但是从typeid(i)返回的std::type_info对象确实引用了int;因为 consttypeid.

忽略了

In all cases, cv-qualifiers are ignored by typeid (that is, typeid(T) == typeid(const T))