Iteration Revisited: A Safer Iteration Model for C++
summary
Argues that pointer-style STL iterators are a UB minefield and presents Flux, a C++20 library that replaces iterators with cursor-based indices (flux_first/is_last/read_at/ink), avoids dangling and invalidation UB by design, and makes read_at bounds-checked (with read_at_unchecked for hotspots). Offers compatibility: contiguous ranges work directly, other ranges wrap via from_range, and every Flux sequence can present a standard iterator. Claims performance is competitive and can beat C++20 Ranges by using for_each_while internal iteration that enables vectorization and optional bounds checks.
AI-written summary · about
chapters (8)
- 0:00Introduction to iteration
- 0:48History of STL iterators
- 4:57The dangers of pointers
- 14:28Designing a safer approach
- 25:07Introduction to the Flux library
- 36:53Sequence adapters and pipelines
- 48:36Compatibility with existing STL
- 52:55Performance and summary
related talks
01h 00mBuilding and Extending the Iterator Hierarchy in a Modern, Multicore World
46mMeandering Through C++ Creating ranges::to
01h 14mReintroduction to Generic Programming for C++ Engineers
01h 36mImplementing Ranges and Views in C++
58mC++17 in Practice - The good and the ugly
29mThe Why of Iterator Design
59mHow to Implement the C++ Standard Library (Part 2): An Excursion into libc++
38mWhat's New In C++23
