fork(11) download
  1. #include <iostream>
  2.  
  3. template<typename T>
  4. std::enable_if_t<std::is_same<int, T>::value, void> foo() {
  5. std::cout << "foo int\n";
  6. }
  7.  
  8. template<typename T>
  9. std::enable_if_t<std::is_same<float, T>::value, void> foo() {
  10. std::cout << "foo float\n";
  11. }
  12.  
  13. int main() {
  14. foo<int>();
  15. foo<float>();
  16. }
Success #stdin #stdout 0s 3140KB
stdin
Standard input is empty
stdout
foo int
foo float