"Mostly Invalid": flat_map, Exception Guarantees, and the STL
summary
Shows concrete failures: a throwing comparator or hasher breaks priority_queue and unordered_set invariants and yields a mostly invalid state where find and iteration disagree; MSVC’s unordered_set is fixed in master but libc++ and libstdc++ behave differently. Analyzed flat_map/flat_set split-storage pitfalls (extract must clear moved-from containers) and committee proposals (P0429, P1843) that either require strong exception guarantee or nuke it from orbit (clear the container) to restore invariants. Presents tradeoffs, examples on Godbolt, and no easy win.
AI-written summary · about
chapters (9)
- 0:00Introduction and overview
- 1:21Container invariants and flat_map
- 2:39Priority queue with throwing comparator
- 12:00MSVC unordered_set rehash exception
- 20:01flat_set and flat_map cross-component invariants
- 23:34flat_map extract and moved-from state
- 32:09Exception guarantees in the STL
- 50:12Path forward and strong guarantees
- 1:01:10Q&A and closing remarks








