fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template<typename T> // primary template
  5. struct is_int
  6. {
  7. static const bool value = false;
  8. };
  9.  
  10. template<> // explicit specialization for T = int
  11. struct is_int<int>
  12. {
  13. static const bool value = true;
  14. };
  15.  
  16.  
  17. int main() {
  18. std::cout << is_int<char>::value << std::endl;
  19. std::cout << is_int<int>::value << std::endl;
  20. return 0;
  21. }
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
0
1