mirror of https://github.com/dnomd343/klotski.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
865 B
30 lines
865 B
#pragma once
|
|
|
|
namespace std {
|
|
|
|
template <>
|
|
struct hash<klotski::group::Group> {
|
|
constexpr std::size_t operator()(const klotski::group::Group &g) const noexcept {
|
|
// TODO: perf hash alg
|
|
return std::hash<uint64_t>{}(g.type_id() ^ g.pattern_id() ^ (int)g.toward());
|
|
}
|
|
};
|
|
|
|
template <>
|
|
struct hash<klotski::group::GroupUnion> {
|
|
constexpr std::size_t operator()(const klotski::group::GroupUnion &gu) const noexcept {
|
|
return std::hash<uint32_t>{}(gu.unwrap());
|
|
}
|
|
};
|
|
|
|
template <>
|
|
struct hash<klotski::group::CaseInfo> {
|
|
constexpr std::size_t operator()(const klotski::group::CaseInfo &info) const noexcept {
|
|
// TODO: perf hash alg
|
|
const auto h1 = std::hash<klotski::group::Group>{}(info.group());
|
|
const auto h2 = std::hash<uint32_t>{}(info.case_id());
|
|
return h1 ^ h2;
|
|
}
|
|
};
|
|
|
|
} // namespace std
|
|
|