📜  如何在 C++ 代码示例中遍历地图

📅  最后修改于: 2022-03-11 14:44:45.959000             🧑  作者: Mango

代码示例2
//Since c++17
for (auto& [key, value]: myMap) {
    cout << key << " has value " << value << endl;
}
//Since c++11
for (auto& kv : myMap) {
    cout << kv.first << " has value " << kv.second << endl;
}