fork download
  1. #include <vector>
  2.  
  3. template <typename T>
  4. void sort(T &container) {}
  5.  
  6. template <typename F, typename T>
  7. void sort_container(F sort_func, T container) {
  8. sort_func(container);
  9. }
  10.  
  11. int main() {
  12. std::vector<int> x = {1,2,3};
  13. sort_container(sort, x);
  14. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:13:27: error: no matching function for call to ‘sort_container(<unresolved overloaded function type>, std::vector<int>&)’
prog.cpp:13:27: note: candidate is:
prog.cpp:7:6: note: template<class F, class T> void sort_container(F, T)
prog.cpp:7:6: note:   template argument deduction/substitution failed:
prog.cpp:13:27: note:   couldn't deduce template parameter ‘F’
stdout
Standard output is empty