Skip to content

Add borrowed forward iteration over HAMT snapshots - #469

Draft
helly25 wants to merge 10 commits into
implement/hamt-persistent-erasefrom
implement/hamt-forward-iterator
Draft

helly25 wants to merge 10 commits into
implement/hamt-persistent-erasefrom
implement/hamt-forward-iterator

Conversation

@helly25

@helly25 helly25 commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

Add forward traversal over HAMT bitmap nodes and collision entries as the next step toward general map/set containers. Iterator copies carry independent traversal positions without allocating traversal storage.

AG;DR

Adds the shared-node iterator library, fixture-based tests, Bazel targets, and lifetime documentation. Traversal uses an inline bounded frame stack derived from hash width and fragment width. Entries remain borrowed: the snapshot root and allocation source must outlive iteration. End iterators compare equal; non-end positions include root identity. Public container range identity is a later layer.

Tests cover empty roots, bitmap data, children, collisions, independent iterator copies, and forward-iterator concepts. Initial validation passed 163 tests with one exception-only target skipped, measured focused LLVM coverage of 39/39 lines and 12/12 branches, and passed focused ASAN. These historical results are not substituted for current-head validation.

GCC 14 required explicit HamtInsertResult types for all four optional fallbacks. The subsequent CI clang-tidy diagnostics are corrected by explicitly parenthesizing the depth division and making three unchanged test iterators const. Focused tests and focused pre-commit pass on head 14d49ff, with local clang-tidy and trunk formatting disabled as requested. Full current-head local validation and replacement remote CI are in progress. macOS validation uses native Apple ld for SDK compatibility with the hermetic compiler.

C++20 compatible. No coverage scope, exclusion, threshold, or baseline changes. Draft implementation step; no merges or performance conclusions.

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