fork(1) download
  1. #include <iostream>
  2.  
  3. struct int_wrapper { int i ; /* .... */ } ;
  4.  
  5. std::ostream& print( const int_wrapper& w ) { return std::cout << '{' << w.i << "} " ; }
  6.  
  7. std::ostream& print_all() { return std::cout << '\n' ; }
  8.  
  9. template < typename... T > std::ostream& print_all( const int_wrapper& first, const T&... rest )
  10. {
  11. print(first) ;
  12. return print_all( rest... ) ;
  13. }
  14.  
  15. int main()
  16. {
  17. int_wrapper a{0}, b{1}, c{2}, d{3} ;
  18. print_all() ;
  19. print_all( a ) ;
  20. print_all( a, b ) ;
  21. print_all( a, b, c ) ;
  22. print_all( a, b, c, d ) ;
  23. }
  24.  
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
{0} 
{0} {1} 
{0} {1} {2} 
{0} {1} {2} {3}