From Iterators to Ranges — the Upcoming Evolution of the Standard Library
summary
Think-cell runs a million+ line codebase using Eric Niebler’s range ideas and demonstrates concrete changes: naive nested transform/filter views make iterators balloon exponentially, so an index-based ranges design keeps iterators two words (range pointer + index) and preserves performance. Adding generators/coroutines lets internal iteration outperform iterator-based concat and avoid double work. Practical results: iterator-based lazy repeat_n is ~50% slower than hand code, internal-iteration versions ~15% slower, and a specialized appender saves ~20% over std::string append.
AI-written summary · about
chapters (22)
- 0:00Intro
- 0:40Ranges in C++20
- 1:53Why do I think I know something about ranges? think-cell
- 4:36What are Ranges?
- 8:18Transform Adaptor (2)
- 9:01Transform Adaptor Implementation
- 10:14Filter Adaptor Implementation
- 13:48More Efficient Range Adaptors: Iterator Safety think-cell
- 15:28Again: How does iterator look like of
- 17:13Index-Iterator Compatibility
- 18:27Super-Efficient Range Adaptors With Indices
- 24:34More Flexible Algorithm Returns (3)
- 29:11External iteration (2)
- 32:08Coroutines (2)
- 34:36Internal Iteration often good enough
- 39:45Interruptable Generator Ranges (2)
- 41:23concat implementation with indices (2)
- 43:03concat implementation as generator range
- 46:52Format Strings
- 49:13Formatting Into Containers (1)
- 54:15Fast Formatting Into Containers
- 59:37Better reserve
related talks
56m“Range-Based Text Formatting For a Future Range-Based Standard Library”
01h 09mMissing (and future?) C++ Range Concepts
01h 02mC++20 Ranges in Practice
01h 01mAn Overview of Standard Ranges
05mBest of think-cell's Range Library
59mRange-Based Text Formatting - For a Future Range-Based Standard Library
01h 09mRe-Release: Missing (and future?) C++ Range Concepts
01h 01mFrom STL to Ranges: Using Ranges Effectively
