随笔 获取类型的名称

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zhdzxc123/article/details/81507720
#include <boost/core/demangle.hpp>

namespace zero{

    class test{
    public:
        test(){}
    };

}


int main(){

    std::string name = boost::core::demangle(typeid(zero::test).name());

    std::cout << name << std::endl;


    return 0;
}

通过typeid, 获取id , 转化为字符串

猜你喜欢

转载自blog.csdn.net/zhdzxc123/article/details/81507720
今日推荐