Iterate over Dictionary (C++ unordered_map)
# C++17
unordered_map<int,string> hash;
for( auto& [k,v]: hash) { // C++17
...
}unordered_map<int,string> hash;
for( auto& [k,v]: hash | std::views::reverse) { // C++20
...
}
Written on February 1, 2021, Last update on July 4, 2026
c++
loop
iterate
dictionary
tuple
hash