fork download
  1. #include <iostream>
  2.  
  3. template <typename T, std::size_t N>
  4. void Function(const T (&a)[N])
  5. {
  6. std::cout << "{";
  7. const char* sep = "";
  8. for (const auto& e : a) {
  9. std::cout << sep << e;
  10. sep = ", ";
  11. }
  12. std::cout << "}\n";
  13. }
  14.  
  15. template <typename T, typename... Ts>
  16. void Function(const T& t, const Ts&... args)
  17. {
  18. Function(t);
  19. Function(args...);
  20. }
  21.  
  22. int main()
  23. {
  24. int P1[] = {0, 1, 2, 3, 4};
  25. const char* P2[] = {"Hello", "World"};
  26. // ...
  27. char Pn[] = {'0', '1', 'A', 'Z'};
  28.  
  29. Function(P1, P2, Pn);
  30. }
  31.  
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
{0, 1, 2, 3, 4}
{Hello, World}
{0, 1, A, Z}