fork download
  1. #include <array>
  2. #include <iostream>
  3.  
  4. template <typename ...ArgsT>
  5. void foobar (ArgsT ...a) {
  6. std::array<int, sizeof... (ArgsT)> args {a...};
  7. std::cout << "{";
  8. for (auto i : args) std::cout << i;
  9. std::cout << "}\n";
  10. }
  11.  
  12. int main () {
  13. foobar ();
  14. foobar (1, 2, 3);
  15. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'void foobar(ArgsT ...)':
prog.cpp:8:17: error: expected initializer before ':' token
prog.cpp:10:1: error: expected primary-expression before '}' token
prog.cpp:10:1: error: expected ')' before '}' token
prog.cpp:10:1: error: expected primary-expression before '}' token
prog.cpp:10:1: error: expected ';' before '}' token
stdout
Standard output is empty