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;
2.1m questions
2.1m answers
60 comments
57.0k users