C++ Iteration Revisited 2024
summary
Argues that STL iterators cause UB (dangling, invalidation, out‑of‑bounds) and replaces pointer semantics with an index/cursor model implemented in Flux, a C++20 library that makes the four iteration ops explicit (init, is_last, read_at, inc). Flux defaults to bounds‑checked reads, returns optionals for empty results, preserves compatibility with STL ranges, offers an unsafe read_at_unchecked, and uses an internal iteration hook for_each_while to let compilers auto‑vectorize (examples show AVX and cases where Flux outperforms C++20 ranges).
AI-written summary · about
chapters (10)
- 0:00Introduction
- 1:34Safer iteration motivation
- 19:27Iteration models theory
- 24:21Index-based iteration safety
- 33:15Flux library concept
- 49:30Flux practical examples
- 1:01:41Sequence protocol in Flux
- 1:07:43STL ranges compatibility
- 1:12:18Performance optimizations
- 1:21:55Summary
related talks
01h 01mIteration Revisited: A Safer Iteration Model for Cpp
01h 06mConquering C++20 Ranges
01h 05mBetter C++ ranges
01h 00mMissing (and future?) C++ range concepts
01h 02mBack to Basics: Classic STL
01h 04mRange adaptors - 5 years after C++20
01h 04mEffective Ranges: A Tutorial for Using C++2x Ranges
01h 05mThe Imperatives Must Go!
