多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
[TOC] ## 元组 关于元组的使用有三个核心的函数: 1. `std::make_tuple`: 构造元组 2. `std::get`: 获得元组某个位置的值 3. `std::tie`: 元组拆包 ## 示例 ``` map<string, tuple<int, int, string>> student; student["a"] = make_tuple(1, 1, "aaa"); student["c"] = make_tuple(2, 2, "bbb"); for (auto [key,val] : student) { auto [i1, i2, s1] = val; cout << key << ":" << i1 << " " << i2 << " " << s1 << "\n"; } // output: // a:1 1 aaa // c:2 2 bbb ```