Files
modern-cpp-tutorial/code/2/2.16.fold.expression.cpp
2019-07-11 11:07:10 +02:00

16 lines
300 B
C++

//
// 2.16.fold.expression.cpp
// chapter 2 language usability
// modern cpp tutorial
//
// created by changkun at changkun.de
//
#include <iostream>
template<typename ... T>
auto sum(T ... t) {
return (t + ...);
}
int main() {
std::cout << sum(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) << std::endl;
}