#include <iostream>#include <type_traits>#include <vector> template<typename Container>typename std::enable_if<std::is_same<typename Container::value_type, int>::value, void>::valuefoo(Container& container){ std::cout << "test\n";} int main(){ std::vector<int> ok; foo(ok); std::vector<unsigned int> error; foo(error);}
Standard input is empty
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>&)'
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!