fork download
  1. #include <iostream>
  2.  
  3. void Foobar() {}
  4.  
  5. template<typename First, typename... Rest>
  6. void Foobar(const First &val, Rest... args)
  7. {
  8. val.PrintContent();
  9. Foobar(args...);
  10. }
  11.  
  12. template<typename... Rest>
  13. void Foobar(const int val, Rest... args)
  14. {
  15. std::cout << val << std::endl;
  16. Foobar(args...);
  17. }
  18.  
  19. struct A {
  20. A(int a): b(a) {}
  21. void PrintContent() const {
  22. std::cout << "A: " << b << std::endl;
  23. }
  24. int b;
  25. };
  26.  
  27. int main() {
  28. Foobar(5, 6, 7, A(1));
  29. }
Success #stdin #stdout 0s 2928KB
stdin
Standard input is empty
stdout
5
6
7
A: 1