fork(8) download
  1. #include <iostream>
  2. #include <type_traits>
  3.  
  4. enum class EnumClass {};
  5. enum Enum {};
  6. class Class {};
  7.  
  8. template<typename E>
  9. using is_class_enum = std::integral_constant<
  10. bool,
  11. std::is_enum<E>::value && !std::is_convertible<E, int>::value>;
  12.  
  13. int main(int argc, char* argv[]) {
  14. std::cout << is_class_enum<EnumClass>::value << '\n';
  15. std::cout << is_class_enum<Enum>::value << '\n';
  16. std::cout << is_class_enum<Class>::value << '\n';
  17. return 0;
  18. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
1
0
0