Print template typename at compile time

后端 未结 6 1172
予麋鹿
予麋鹿 2020-12-08 09:41

When creating a template function in C++ is there a simple way to have the typename of the template represented as a string? I have a simple test case to show what I\'m try

6条回答
  •  隐瞒了意图╮
    2020-12-08 10:19

    There is Boost.TypeIndex library.

    See boost::typeindex::type_id for details.

    It is very-easy-to-use, cross-platform and is real compile-type solution. Also it works as well even if no RTTI available. Also most of compilers are supported from the box.

提交回复
热议问题