Choosing between std::map and std::unordered_map [duplicate]
问题 This question already has an answer here: Is there any advantage of using map over unordered_map in case of trivial keys? 12 answers Now that std has a real hash map in unordered_map , why (or when) would I still want to use the good old map over unordered_map on systems where it actually exists? Are there any obvious situations that I cannot immediately see? 回答1: As already mentioned, map allows to iterate over the elements in a sorted way, but unordered_map does not. This is very important