How can I sort an unordered_map by key? I need to print an unordered_map sorted by key.
unordered_map
std::unordered_map<int, int> unordered; std::map<int, int> ordered(unordered.begin(), unordered.end()); for(auto it = ordered.begin(); it != ordered.end(); ++it) std::cout << it->second;
1.4m articles
1.4m replys
5 comments
57.0k users