Why can’t I compile an unordered_map with a pair as key?

You need to provide a suitable hash function for your key type. A simple example: #include <unordered_map> #include <functional> #include <string> #include <utility> // Only for pairs of std::hash-able types for simplicity. // You can of course template this struct to allow other hash functions struct pair_hash { template <class T1, class T2> std::size_t operator … Read more