|
|
@ -227,6 +227,17 @@ struct hash<pod_key_t<N>> { |
|
|
|
size_t operator()(const pod_key_t<N>& k) const { return XXH3_64bits(&k, sizeof(pod_key_t<N>)); } |
|
|
|
}; |
|
|
|
|
|
|
|
template <> |
|
|
|
struct hash<compact_bg_mesh_coord_t> { |
|
|
|
using argument_type = compact_bg_mesh_coord_t; |
|
|
|
using result_type = size_t; |
|
|
|
|
|
|
|
result_type operator()(const argument_type& coord) const noexcept { |
|
|
|
// 使用 uint64_t 的哈希算法,将 hashed_value 映射为 size_t
|
|
|
|
return static_cast<result_type>(std::hash<uint64_t>()(coord.hashed_value)); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
template <> |
|
|
|
struct equal_to<vertex_header_t> { |
|
|
|
bool operator()(const vertex_header_t& v1, const vertex_header_t& v2) const |
|
|
@ -256,7 +267,12 @@ template <size_t N> |
|
|
|
struct equal_to<pod_key_t<N>> { |
|
|
|
bool operator()(const pod_key_t<N>& k1, const pod_key_t<N>& k2) const |
|
|
|
{ |
|
|
|
return static_cast<std::array<uint32_t, N>>(k1) == static_cast<std::array<uint32_t, N>>(k2); |
|
|
|
std::array<uint32_t, N> a, b; |
|
|
|
for (size_t i = 0; i < N; ++i) { |
|
|
|
a[i] = static_cast<uint32_t>(k1[i]); |
|
|
|
b[i] = static_cast<uint32_t>(k2[i]); |
|
|
|
} |
|
|
|
return a == b; |
|
|
|
} |
|
|
|
}; |
|
|
|
} // namespace std
|