Skip to content

feat(data): gtl flat_hash_map and flat_hash_set instead of std::unordered_map - #19

Merged
codethinki merged 2 commits into
masterfrom
feat/gtl-hash-map
Oct 21, 2026
Merged

codethinki merged 2 commits into
masterfrom
feat/gtl-hash-map

Conversation

@codethinki

Copy link
Copy Markdown
Owner

Depends on codethinki/cth_cmake#8. lib/cth_cmake points at the commit of that PR branch; after #8 is merged it has to move to the merged commit before this PR is merged.

  • gtl becomes a dependency of the cth component: gtl in vcpkg.json, and cth/cmake/Findgtl.cmake (gtl installs only its headers and no CMake package), registered with cth_pkg_add_find_modules and found with cth_pkg_target_find_package(cth gtl MODULE REQUIRED). The installed package ships the module, so consumers of the installed cth need nothing but gtl.
  • new cth/data/hash_map.hpp: cth::dt::flat_hash_map and cth::dt::flat_hash_set, aliases of the gtl types (no pointer stability)
  • std unordered containers replaced:
    • data/pool.hpp, data/thread_pool.hpp, the thread pool test and cth_net websocket server: the flat gtl types
    • data/union_find.hpp all(): a std::vector indexed by the root, the roots are indices and all() stays constexpr
    • algorithm/combine.hpp: the node map becomes a flat_hash_map; the element pool stays std::unordered_set, it keeps pointers to its elements and needs the pointer stability

Tested: gcc_debug build without errors or warnings, all 272 tests pass. The installed package works from a consumer with find_package(cth CONFIG REQUIRED COMPONENTS cth) and the real gtl. cth_engine builds against this branch (with cth_cmake#8) and its 318 tests pass.

@codethinki
codethinki enabled auto-merge (squash) October 21, 2026 09:24
@codethinki
codethinki merged commit 9b0417a into master Oct 21, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant