AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
[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 ```