unordered_map非内蔵タイプカスタムhash

3128 ワード

struct KeyHasher
{
	std::size_t operator()(const std::pair<unsigned int, unsigned int>& k) const
	{
		using std::size_t;
		using std::hash;

		return ((hash<unsigned  int>()(k.first)
			^ (hash<unsigned  int>()(k.second) << 8)) >> 8);
	}
};

unordered_map<std::pair<unsigned int, unsigned int>, bool, KeyHasher> info;