兼容性问题修复 #9

Closed
wch wants to merge 3 commits from wch into V2
wch commented 11 months ago
Collaborator

一是为 compact_bg_mesh_coord_t 添加了 std::hash 特化,使其可作为哈希容器的键使用;二是将插入普通 std::vector 到需自定义分配器容器的操作改为使用 stl_vector_mp,解决了构造函数不匹配的问题;三是修正了对 std::array 的类型转换方式,由原本非法的 static_cast 改为逐元素显式转换。三项修改共同提升了代码的正确性、健壮性与可维护性。

一是为 compact_bg_mesh_coord_t 添加了 std::hash 特化,使其可作为哈希容器的键使用;二是将插入普通 std::vector 到需自定义分配器容器的操作改为使用 stl_vector_mp,解决了构造函数不匹配的问题;三是修正了对 std::array 的类型转换方式,由原本非法的 static_cast 改为逐元素显式转换。三项修改共同提升了代码的正确性、健壮性与可维护性。
wch added 3 commits 11 months ago
Owner
  1. compact_bg_mesh_coord_t本质上是一个uint64_t,且满足std::hash构造默认实现的要求(见https://en.cppreference.com/w/cpp/utility/hash.html) ,理论上不再需要手动实现一个版本;
  2. 目前这部分代码已有改动,应该不存在此类问题;
  3. pod_key_t是std::array<uint64_t, N>的别名模板,此处强制转换仅用于使用std::array的operator==()。不过强制转换到uint32_t确实不太对,可以单独交一个MR
1. compact_bg_mesh_coord_t本质上是一个uint64_t,且满足std::hash构造默认实现的要求(见https://en.cppreference.com/w/cpp/utility/hash.html) ,理论上不再需要手动实现一个版本; 2. 目前这部分代码已有改动,应该不存在此类问题; 3. pod_key_t<N>是std::array<uint64_t, N>的别名模板,此处强制转换仅用于使用std::array的operator==()。不过强制转换到uint32_t确实不太对,可以单独交一个MR
ZCWang closed this pull request 11 months ago
This pull request cannot be reopened because the branch was deleted.
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This pull request currently doesn't have any dependencies.

Loading…
There is no content yet.