fork download
  1. // HelloWorld.cpp : Defines the entry point for the console application.
  2. //
  3. #include <iostream>
  4. #include <string>
  5.  
  6. template<typename T>
  7. void show(const T& value)
  8. {
  9. std::cout << value << std::endl;
  10. }
  11.  
  12.  
  13. template<typename U, typename... T>
  14. void foo(const U& head, const T&... tail)
  15. {
  16. std::cout << head;
  17. show(tail...);
  18. }
  19.  
  20. int main()
  21. {
  22. int a = 12;
  23. std::string tbone("Tbone");
  24. foo(tbone, a, a);
  25. return 0;
  26. }
  27.  
  28.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'void foo(const U&, const T& ...) [with U = std::basic_string<char>, T = {int, int}]':
prog.cpp:24:17:   instantiated from here
prog.cpp:17:2: error: no matching function for call to 'show(const int&, const int&)'
stdout
Standard output is empty