class Foo { public: Foo(tuple<int, double>) { cout << "Foo(tuple<int, double>)"<< endl; } template <typename T> void print(T t) { cout << t << endl; } template <typename T, typename ...Args> void print(T t, Args... args) { cout << t << endl; print(args...); } template <typename... Args> Foo(Args... args) { cout << __FUNCTION__ << "Foo(Args... args)"<< endl; //int arr[] = {(print(args), 0)...}; print(args...); } };
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
auto tp = make_tuple(1,2.22);
pair<int, Foo> p1(42, tp);
pair<int, Foo> p2(piecewise_construct, make_tuple(41), tp);
return a.exec();
}
标签:cout,tuple,int,Piecewise,Pari,Construction,tp,Foo From: https://www.cnblogs.com/xzlq/p/16778368.html