fork(2) download
  1. #include <iostream>
  2. #include <typeinfo>
  3. using namespace std;
  4.  
  5. template <typename T0, typename ... Ts>
  6. class foo {};
  7.  
  8. template <typename ... Ts>
  9. void bar(const foo<Ts...> &v){
  10. cout << typeid(v).name() << endl;
  11. }
  12.  
  13. int main() {
  14. // your code goes here
  15. foo<int,double> f;
  16. bar<int,double>(f);
  17. return 0;
  18. }
Compilation error #stdin compilation error #stdout 0s 3340KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:16:19: error: no matching function for call to ‘bar(foo<int, double>&)’
  bar<int,double>(f);
                   ^
prog.cpp:16:19: note: candidate is:
prog.cpp:9:6: note: template<class ... Ts> void bar(const foo<Ts ...>&)
 void bar(const foo<Ts...> &v){
      ^
prog.cpp:9:6: note:   template argument deduction/substitution failed:
prog.cpp:16:19: note:   mismatched types ‘double’ and ‘double’
  bar<int,double>(f);
                   ^
stdout
Standard output is empty