How to know if the argument that is passed to the function is a class, union or enum in c++?

前端 未结 4 445
伪装坚强ぢ
伪装坚强ぢ 2021-01-03 07:14

I want to define an operator<< for all enums, to cout the value and print that it is an enum like this:

code:

enum AnyEnum{A,B,C};
AnyEnum enm          


        
4条回答
  •  一向
    一向 (楼主)
    2021-01-03 08:15

    its not possible to know the variable type at compile time.

提交回复
热议问题