68.模板参数展开

 1 #include <iostream>
 2 #include <cstdarg>
 3 using namespace std;
 4 
 5 template <class T>
 6 void show(T t)
 7 {
 8     cout << t << endl;
 9 }
10 
11 template <class...Args>
12 void all(Args...args)
13 {
14     int arr[] = { (show(args),0)... };
15     //int arr[],约束展开,模板展开
16 }
17 
18 void main()
19 {
20     all(1, 2, 3, 4, 5, 6);
21     cin.get();
22 }
原文地址:https://www.cnblogs.com/xiaochi/p/8569201.html