fork(3) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int print_test(int i)
  5. {
  6. std::cout << i;
  7. return 0;
  8. }
  9.  
  10. template <typename... Args>
  11. void print(Args... args)
  12. {
  13. int chapuza = 0;
  14. const int n = sizeof...(args);
  15.  
  16. using expandir = int[];
  17. (void) expandir {0, ((void)print_test(args), chapuza++, chapuza == n ? std::cout << '\n' : std::cout << ',', 0)...};
  18.  
  19.  
  20. }
  21.  
  22. int main() {
  23. // your code goes here
  24. print(1,2,3,4,5);
  25. return 0;
  26. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
1,2,3,4,5