我正在尝试遍历元组向量:
std::vector<std::tuple<int, int, int>> tupleList;
通过使用具有结构化绑定的基于范围的 for 循环:
for (auto&& [x, y, z] : tupleList) {}
但是 Visual Studio 2017 15.3.5 给出了错误:
无法推断“自动”类型(需要初始化程序)
但以下确实有效:
for (auto&& i : tupleList) {
auto [x, y, z] = i;
}
这是为什么?