Integrate type name in static_assert output?

后端 未结 5 961
独厮守ぢ
独厮守ぢ 2020-12-04 18:56

I like to give helpful errors / messages, and I also want to do so for my static_asserts. The problem is, that they depend on template parameters. Normally, tho

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-04 19:45

    std::type_info has a member const char* name():

    #include 
    using namespace std;
    
    //...
    
    const char* name = type_info(T).name();
    

提交回复
热议问题