Multidimensional Iterators
summary
Attempts to abstract nested loops into reusable iterators usually kill vectorization, but here a generate_indices range implemented with C++ coroutines emits the actual nested-for code at the call site, producing identical assembly to the original hand-written loops. It requires compiler coroutine inlining/optimization and a few small tweaks to get full vectorization (Intel compilers previously vectorized only indexing), but the implementation reproduces performance while letting iteration order and layout change by swapping the index generator.
AI-written summary · about
related talks
01h 13mFrom Iterators to Ranges — the Upcoming Evolution of the Standard Library
04mLightning Talk: operator for - C++ Generator Ranges Without Coroutine Overhead
05mfor_each_adjacent<N>
59mFaster, Safer, Better Ranges
01h 15mHow to Rangify Your Code
57mCache friendly data + functional + ranges = ❤️
39mWhy Iterators Got It All Wrong
01h 07mMultidimensional C++
