fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4.  
  5. template < typename T >
  6. std::string foo ( const T & str )
  7. {
  8. return std::string(str) ;
  9. }
  10.  
  11. template < typename T , typename ... Args >
  12. std::string foo ( const T & str , Args ... args )
  13. {
  14. return std::string ( str + foo(args...) ) ;
  15. }
  16.  
  17.  
  18. int main() {
  19. std::cout << foo("Oh", ", ", "my" , " God") << std::endl ;
  20. }
Success #stdin #stdout 0s 3272KB
stdin
Standard input is empty
stdout
Oh, my God