Implementing Ranges and Views in C++
summary
Covers how to implement range adapters and views in C++: building a closure that returns a view, fixing dangling temporaries by moving into an owning view, and using the CRTP helpers and views::all to choose between ref_view vs owning_view lifetimes. Explains subrange sizing causing extra passes (distance may re-traverse chunks), multi-input merges implemented with a heap or as a coroutine via std::generator, and tradeoffs between laziness, iterator category, and performance.
AI-written summary · about
chapters (13)
- 0:00Introduction and speaker background
- 1:49What are ranges and views
- 10:38Composability and chaining examples
- 16:20Overview of standard range views
- 24:32Implementing range adapters
- 33:44Expression templates and lifetime management
- 42:55Views::all and ownership handling
- 48:43Lazy evaluation and iterators
- 53:19Range categories and refinements
- 1:03:29Cons correctness and iterator pitfalls
- 1:06:03Iterator customization points
- 1:08:52Case study: Sorted range views
- 1:28:27Summary and Q&A
related talks
46mMeandering Through C++ Creating ranges::to
38mWhat's New In C++23
59mHow to Implement the C++ Standard Library (Part 2): An Excursion into libc++
05m23 Ranges: slide & stride
47mA Journey into Ranges, Views, Pipelines, and Currying
56mThrowing Tools at Ranges
58mC++17 in Practice - The good and the ugly
01h 27mUniversal/Forwarding References - A Key to More Modern C++
