代码之家  ›  专栏  ›  技术社区  ›  Archith

typeid().name()输出中显示的整数是什么意思?

  •  0
  • Archith  · 技术社区  · 3 年前

    的输出中显示的整数是多少 typeid().name() 意思是例如:

    #include<iostream>
    #include<typeinfo>
    
    class implementer{
    public :
        void forNameSake()
        {
        }
    };
    
    int main()
    {
        implementer imp2;
        std::cout<<typeid(imp2).name();
    }
    

    给出输出:

    11实施者

    什么是 11 在输出均值中?

    1 回复  |  直到 3 年前
        1
  •  3
  •   Remy Lebeau    3 年前

    输出中的11是什么意思?

    在这种特殊情况下,很可能 它表示后面的标识符的长度。 implementer 是11个字符。

    你可能对 https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangle.name ,特别是在 <source-name> ::= <positive length number> <identifier> 部分

    推荐文章