Browse Source

为 compact_bg_mesh_coord_t 提供 std::hash 特化

wch
mckay 1 week ago
parent
commit
bbe937a0d1
  1. 11
      network_process/interface/fwd_types.hpp

11
network_process/interface/fwd_types.hpp

@ -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

Loading…
Cancel
Save