fork(3) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. namespace foo {
  5. template<typename T>
  6. void cout (const T& value) {
  7. std::cout<<value;
  8. }
  9.  
  10. template<typename T, typename... R>
  11. void cout (const T& head, const R&... tail) {
  12. std::cout << head;
  13. cout(tail...);
  14. }
  15. }
  16.  
  17. int main() {
  18. using foo::cout;
  19. cout(23, endl, 12312, "\n", 12412);
  20. return 0;
  21. }
  22.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:19:35: error: no matching function for call to 'cout(int, <unresolved overloaded function type>, int, const char [2], int)'
  cout(23, endl, 12312, "\n", 12412);
                                   ^
prog.cpp:19:35: note: candidates are:
prog.cpp:6:6: note: template<class T> void foo::cout(const T&)
 void cout (const T& value) {
      ^
prog.cpp:6:6: note:   template argument deduction/substitution failed:
prog.cpp:19:35: note:   candidate expects 1 argument, 5 provided
  cout(23, endl, 12312, "\n", 12412);
                                   ^
prog.cpp:11:6: note: void foo::cout(const T&, const R& ...) [with T = int; R = {}]
 void cout (const T& head, const R&... tail) {
      ^
prog.cpp:11:6: note:   candidate expects 1 argument, 5 provided
stdout
Standard output is empty