Immutable Data Structures in C++
summary
Shows that C++’s reference semantics cause real production bugs (iterator invalidation from concurrent push_back) and that passing heavy objects by value fixes races but costs copies. Introduces persistent vectors (tree of fixed-size arrays, structural sharing, branching factor ≈32) where lookup and append are O(log_32 n) — effectively constant (e.g., a billion → ~5 levels, a trillion → ~8). Implements push_back by copying only the path nodes, reusing most memory; benchmarks aren’t exhaustive but ICFP 2017 C++ results report reasonable performance vs std::vector.
AI-written summary · about
chapters (6)
- 0:00Immutable data structures intro
- 3:18Value vs reference semantics
- 17:00Value semantics challenges
- 27:56Persistent data structures
- 36:22Safety vs performance trade-offs
- 38:10Conclusion
related talks
01h 06mPostmodern immutable data structures
01h 00mOLD VERSION: The Fine Details Behind C++ Containers And Algorithms
01h 00mThe Fine Details Behind C++ Containers And Algorithms
01h 01mFunctional C++
01h 03mFunctional C++ for Fun & Profit
44mC++ Performance and Optimisation
57mCache friendly data + functional + ranges = ❤️
01h 00mMoving Faster: Everyday efficiency in modern C++
