Missing (and future?) C++ range concepts
Jonathan Müller
Iterators and ranges have been essential parts of the C++ standard library since its inception. With C++20, they were brought to the next level in the form of std::ranges
: We now have formalized requirements on the algorithms, lazy views to enable pipelines, and much more powerful iterators. Since then, more and more views and algorithms have been added in C++23.
However, the fundamental concepts have mostly been left unchanged, even though there are still some rough edges. This talk explores new kinds of ranges that are not possible with the existing C++ range concepts. We will first look at compile-time-sized, approximately sized, and infinite ranges, then at noncontiguous ranges with contiguous chunks. Finally, we will explore an optimization to make many algorithms much more efficient by using a pushed-based for_each_while(rng, sink)
customization point instead of pull-based iterators.
Optimization gives us a glimpse into a world where ranges are no longer constrained by iterators, enabling heterogeneous ranges of multiple types. Heterogeneous ranges allow us to use types like std::tuple
in range algorithms, do type-based metaprogramming using regular views, and efficiently handle ranges over polymorphic types. This truly takes the power of ranges to the next level!

Jonathan Müller
Jonathan is a Software Engineer at think-cell. There, he is responsible for maintaining think-cell's core libraries, which include a custom range library, a fast and convenient JSON parser, and many other utilities and data structures to write elegant C++ code. Before working at think-cell, he wrote many useful open-source C++ libraries. Jonathan is also a member of the C++ standardization committee, where he serves as the assistant chair for std::ranges and is a frequent conference speaker.