C++ Get name of type in template

后端 未结 10 2124
天涯浪人
天涯浪人 2020-11-27 11:28

I\'m writing some template classes for parseing some text data files, and as such it is likly the great majority of parse errors will be due to errors in the data file, whic

10条回答
  •  死守一世寂寞
    2020-11-27 12:17

    As mentioned by Bunkar typeid(T).name is implementation defined.

    To avoid this issue you can use Boost.TypeIndex library.

    For example:

    boost::typeindex::type_id().pretty_name() // human readable
    

提交回复
热议问题