Conversation
A total_map that has additionally proven, at construction, that a projection maps no two of its values to equal results -- the type-level carrier of an emap::all_unique proof. The proven-distinct ids license the one operation total_map cannot have: lookup by id, find(), partial by signature (a const V*) because only unambiguity was proven, not presence. Construction is always through a proven table: the primary constructor promotes a total_map (implicit and consteval, so an API taking keyed_map demands the missing proof at the call site), and the row authoring forms build the total_map first -- key diagnostics stay total_map's own, verbatim, mirroring mutable_total_map's delegation. Two new diagnostics, because the fixes differ: `duplicate value` under the identity default (the rows are wrong) and `values collide under projection` otherwise (question Proj before the rows). The colliding slots ride the error functions' TEMPLATE arguments -- measured on g++ 13.3: constant-evaluation notes echo the failing source line but do not print evaluated runtime arguments, so the slots must be part of the instantiated name to reach the diagnostic text. That in turn forces the pairwise check to unroll over index_sequence rather than loop, since a loop variable cannot be a template argument. emap::keyable mirrors emap::buildable -- same two passing forms, same outermost-construction portability rule -- and subsumes it: one predicate answers for the whole construction, key checks included. Covered by inline selftests (identity and projected ids, member-pointer and lambda projections, string_view content equality, keyable both forms), three negative cases pinning both new diagnostics and the delegated key diagnostic, and the consumer test now exercising all three headers plus a runtime find() through every install path.
- join: correct the proof attribution (b's injectivity and count equality are not consumed by validity); bijection stays demanded, now for the stated re-keying guarantee. - bijection: count-mismatch probes are hard errors, accepted with precedent; negative test only. Tag door needs no total_map door (from() is the check-free path); friendship spelled for all specializations; bijection<E,E> permutations are legal and get a selftest. - Decide the pairwise-walker duplication deliberately (local twin, no shared detail helper). - snapshot_map: scope the self-contained claim (id-aliasing caveat), spell K/V asserts and the kept copy constructor. - Conventions: add CHANGELOG/version-bump line; fix the deferred-features cross-reference (§6 -> §5 Step 4+).
Also repairs two latent gaps from the keyed_map step, found by running the full closeout here: selftest_keyed never joined the test matrix, and the bare-copy consumer stage still staged a hand-written two-header list, so it has been red since keyed_map.h shipped. The matrix TU list now names every selftest TU, and the bare stage globs include/emap/*.h — a list that reads the directory cannot go stale.
The refusal checks go through selftest-local concepts, necessarily: a requires-expression outside a templated entity hard-errors on an invalid expression instead of answering false. Also renames keyed_map's selftest kFromFn to kKeyedFromFn — it collided with mutable_total_map's, and the snapshot selftest TU is the first to compile both headers' selftests together.
keyed_map's README section and changelog entry were owed from its own step; batched here with the two new headers' docs, per the design doc's author's-call clause.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.