fork(2) download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4.  
  5. template <template <class> class T, typename U>
  6. void foo(const T<U>& t)
  7. {
  8. std::cout << t.size() << std::endl;
  9. }
  10.  
  11.  
  12. int main()
  13. {
  14. std::vector<int> v = { 1, 2, 3 };
  15. foo(v);
  16.  
  17. return 0;
  18. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:15:7: error: no matching function for call to ‘foo(std::vector<int>&)’
  foo(v);
       ^
prog.cpp:6:6: note: candidate: template<template<class> class T, class U> void foo(const T<U>&)
 void foo(const T<U>& t)
      ^~~
prog.cpp:6:6: note:   template argument deduction/substitution failed:
prog.cpp:15:7: error: wrong number of template arguments (2, should be 1)
  foo(v);
       ^
prog.cpp:5:34: note: provided for ‘template<class> class T’
 template <template <class> class T, typename U>
                                  ^
stdout
Standard output is empty