tuple可以最多将10个类型捆绑起来, 用法看代码吧... #include <iostream> #include <string> #include <tuple> #include <stack> using namespace std; void Test2() { tr1::tuple <char, int, string, double> a('A', 1, "TEXT1", 123.321); cout << tr1::get<0>(a) << endl; cout << tr1::get<1>(a) << endl; cout << tr1::get<2>(a) << endl; cout << tr1::get<3>(a) << endl; stack <tr1::tuple <string, int> > s; for (int i=0; i<6; i++) { char buf[20]; tr1::tuple <string, int> t(string("姓名")+itoa(i, buf, 10), i); s.push(t); } cout << "姓名/t学号" << endl; while (!s.empty()) { tr1::tuple <string, int> t(s.top()); s.pop(); cout << tr1::get<0>(t) << "/t" << tr1::get<1>(t) << endl; } } void main() { try { Test2(); } catch (exception e) { cout << e.what() << endl; } }