Range-Based Text Formatting - For a Future Range-Based Standard Library
summary
Proposes replacing format strings with C++20-style ranges that produce lazily evaluated character sequences: formatters are generator ranges that capture values and only render on iteration, avoiding per-piece heap allocations and doing a single allocation at the end. Implements an explicit-cast-to-string, custom appenders with a chunk hook for pre-reserve, and a swapped model using internal iteration so iteration is produced-from-bottom-of-stack. Benchmarks show iterator-based ranges cost ~50% vs hand code, internal-iteration ranges cost about 15% slower than hand-optimized code.
AI-written summary · about
chapters (10)
- 0:00Intro
- 3:14Format Strings: Cons
- 7:28Format Strings: 18N
- 15:27Essence of Ranges
- 21:55Ranges for Text Formatting (1)
- 33:36Avoid Heap Allocation For Components think-cell
- 35:42Fast Formatting Into Containers
- 40:41Iterators Cost Performance
- 43:28External iteration (2)
- 55:44Performance: Future Work
related talks
58mThe Surprising Complexity of Formatting Ranges in Cpp
01h 02mC++20 Ranges in Practice
01h 09mMissing (and future?) C++ Range Concepts
01h 13mFrom Iterators to Ranges — the Upcoming Evolution of the Standard Library
01h 09mRe-Release: Missing (and future?) C++ Range Concepts
01h 01mFrom STL to Ranges: Using Ranges Effectively
01h 01mAn Overview of Standard Ranges
01h 06mC++20 Ranges in Practice
