fork(1) download
  1. #include <iostream>
  2. #include <type_traits>
  3.  
  4. template<typename T, typename = void>
  5. struct Test
  6. {
  7. static int constexpr value = 1;
  8. };
  9. template<typename T>
  10. struct Test
  11. <
  12. typename std::enable_if
  13. <
  14. std::is_integral<T>::value,
  15. T
  16. >::type, T
  17. >
  18. {
  19. static int constexpr value = 2;
  20. };
  21.  
  22. int main()
  23. {
  24. std::cout << Test<short>::value << std::endl;
  25. }
  26.  
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
1