Skip to content

docs(containers): fix the constexpr FlatMap example & find wording (roadmap 11.7) - #46

Merged
danielPoloWork merged 1 commit into
mainfrom
docs/flatmap-example-and-find-wording
Jul 5, 2026
Merged

docs(containers): fix the constexpr FlatMap example & find wording (roadmap 11.7)#46
danielPoloWork merged 1 commit into
mainfrom
docs/flatmap-example-and-find-wording

Conversation

@danielPoloWork

Copy link
Copy Markdown
Owner

Summary

Fixes the original discrepancy that started Milestone 11: reconciles the spec §5 find wording
with the shipped iterator API, and turns the illustrative "constexpr FlatMap" example into a
compile-verified one. Closes Milestone 11. Doc/test only; no library logic change.

Motivation

Spec-review acceptance criterion: "the §3 example compiles and matches its title," and the §5
error-model reconciliation. Roadmap item 11.7.

Changes

  • Spec §5 reworded. It claimed "FlatMap::find returns an optional-like result"; the shipped
    API returns a const_iterator compared to end(). §5 now states the actual per-channel error
    model (iterator for associative lookup; std::optional for a missing element; status types for
    N-way outcomes), pointing at ADR-0029 and
    the contract table.
  • The "constexpr FlatMap" example is now real and verified. The intake example used
    find(1).has_value(), which never compiled against the iterator API. The corrected example is
    added (a) as a compile-verified static_assert in flat_map_test.cpp
    (FlatMap<int, std::string_view>, insert, iterator-based find, in a constant expression) and
    (b) as a Doxygen snippet in flat_map.hpp. It now compiles and matches its "constexpr" title.
  • Marks Milestone 11 done in README + ROADMAP.

The broken example lives in the untracked intake d4np-cpp.md (not a repo artifact — the frozen
spec is docs/specs/01_spec_util.md); the durable fix is the reconciled §5 wording plus the
mechanically-verified example. The intake file is left untracked.

Design Patterns

  • None.

Verification

  • Local MSVC build: util_tests green including the new constexpr static_assert (a
    failure would fail the build); FlatMap cases pass.
  • clang-format and clang-tidy clean on the changed sources.
  • python tools/consistency_lint.py passes (M11 all-checked; README ↔ ROADMAP consistent).
  • CI matrix — unchanged logic; repo Actions minutes exhausted (any red is billing at startup).

Documentation Impact

  • README.md updated (milestone 11 → ✅ done)
  • ROADMAP.md checkbox flipped (11.7)
  • ADR — n/a (references existing ADR-0029)
  • Spec updated (§5)
  • CHANGELOG.md updated (Fixed)
  • PR metadata — milestone "M11 — Specification & Assurance Hardening"; type label docs

…oadmap 11.7)

Close the last Milestone-11 item — the discrepancy that started the
milestone.

Reconcile spec §5: it claimed "FlatMap::find returns an optional-like
result", but the shipped API returns a const_iterator compared to end()
(the STL-idiomatic form). Reword §5 to state the actual per-channel error
model (iterator for associative lookup, std::optional for a missing
element, status types for N-way outcomes), pointing at ADR-0029 and the
contract table.

Make the illustrative "constexpr FlatMap" example real: the intake's
example used find(1).has_value(), which never compiled against the
iterator API. Add the corrected example as a compile-verified
static_assert in flat_map_test.cpp (constexpr construction + iterator
find over FlatMap<int, std::string_view>) and as a Doxygen snippet in
flat_map.hpp — so the example both compiles and matches its "constexpr"
title.

Marks Milestone 11 (Specification & Assurance Hardening) complete in
README + ROADMAP. Doc/test only; no library logic change.

Local verify (MSVC): util_tests green incl. the new constexpr
static_assert; clang-format + clang-tidy clean; consistency_lint passing.

Refs roadmap 11.7
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@danielPoloWork danielPoloWork added the docs Documentation only label Jul 5, 2026
@danielPoloWork danielPoloWork self-assigned this Jul 5, 2026
@danielPoloWork
danielPoloWork merged commit 7963317 into main Jul 5, 2026
0 of 20 checks passed
@danielPoloWork
danielPoloWork deleted the docs/flatmap-example-and-find-wording branch July 5, 2026 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant