Switch to std::unordered_map/set where possible.