fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template<typename T, std::enable_if_t<std::is_same<T, int>::value>...>
  5. void func(T) {
  6. std::cout << "int" << std::endl;
  7. }
  8.  
  9. template<typename T, std::enable_if_t<!std::is_same<T, int>::value>...>
  10. void func(T) {
  11. std::cout << "non-int" << std::endl;
  12. }
  13.  
  14. int main() {
  15. func(1);
  16. func(1.2);
  17. return 0;
  18. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
int
non-int