fork download
  1. #include <iostream>
  2.  
  3. template< typename... Args>
  4. auto sum(Args... args)
  5. {
  6. return (args + ...);
  7. }
  8.  
  9. int main()
  10. {
  11. long lsum = sum(1, 2, 3, 4, 5);
  12.  
  13. std::string s1 = "He", s2 = "llo ", s3 = "Wor", s4 = "ld";
  14. std::string ssum = sum(s1, s2, s3, s4);
  15.  
  16. std::cout << lsum << std::endl << ssum << std::endl;
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 4448KB
stdin
Standard input is empty
stdout
15
Hello World