is_enum implementation

后端 未结 3 1394
伪装坚强ぢ
伪装坚强ぢ 2021-02-05 07:44

I\'m trying to implement std::is_enum. Here is my code so far:

template
struct is_enum {
    static bool value;
};

template

        
3条回答
  •  一整个雨季
    2021-02-05 08:39

    This

    template
    

    promises that the template argument is a value of type enum E. The argument is NOT a type (Type template arguments are introduced by typename, or for backward compatibility, class. Even struct isn't allowed). It's just like saying

    template
    

    except no name is given for the variable.

    Things go wrong from there.

提交回复
热议问题