fork download
  1. #include <iostream>
  2. #include <type_traits>
  3. #include <vector>
  4.  
  5. template<typename Container>
  6. typename std::enable_if<std::is_same<typename Container::value_type, int>::value, void>::value
  7. foo(Container& container)
  8. {
  9. std::cout << "test\n";
  10. }
  11.  
  12. int main()
  13. {
  14. std::vector<int> ok;
  15. foo(ok);
  16. std::vector<unsigned int> error;
  17. foo(error);
  18. }
  19.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:15:11: error: no matching function for call to 'foo(std::vector<int>&)'
prog.cpp:17:14: error: no matching function for call to 'foo(std::vector<unsigned int>&)'
stdout
Standard output is empty