Conference | Live Schedule | Talks | Get your ticket | Slides | Set your timezone
Missing (and future?) C++ range concepts

Jonathan Müller
On Day 2 at 16:00 (CET/Berlin) in Track E [Amethyst Room and online]
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!
Please login to comment