fork(10) download
  1. #include <iostream>
  2. #include <type_traits>
  3.  
  4. template <typename T, T N, typename = void >
  5. struct X {
  6. static const bool isZero = false;
  7. };
  8.  
  9. template <typename T, T N>
  10. struct X < T, N, typename std::enable_if<N == 0>::type > {
  11. static const bool isZero = true;
  12. };
  13.  
  14. int main(int argc, char* argv[]) {
  15. std::cout << X <int, 0>::isZero << std::endl;
  16. std::cout << X <int, 1>::isZero << std::endl;
  17. return 0;
  18. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
1
0