Swapping std::map for std::unordered_map made my lookups faster and quietly reordered my output. Here is the ordering contract, the rehash, and the operator[] trap.
A focused walkthrough of unordered map patterns built around using unordered_map and unordered_set deliberately instead of treating them like magic storage.