Why STL unordered_map and unordered_set cannot be sorted by STL algorithms?
问题 I'll start by illustrating a simple use case example: Consider the problem of a social security ID database, where in C++ code is modelled as a std::unordered_map where its key is the social security ID of a person and its value is a std::string with the full-name of that person (e.g., std::unordered_map<int, std::string> DB; ). Consider also, that there's a request for printing this database sorted in ascending order based on the person's ID (i.e., std::unordered_map 's key). Naively, one