mirror of
https://github.com/changkun/modern-cpp-tutorial.git
synced 2025-12-17 20:54:39 +03:00
revision #1: 更新第二章中已维护的代码
This commit is contained in:
8
code/2/todo/fold.expression.cpp
Normal file
8
code/2/todo/fold.expression.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user