What a View! Building Your Own (Lazy) Range Adaptors (part 1 of 2)
summary
Three incremental C++ implementations parse Rust-style Unicode escapes like \U{...}: a raw loop, a range-based algorithm, then a lazy range adapters version that composes drop/take into a Unicode subrange and validates 1–6 hex digits. Key tools: C++20 ranges, sentinels, counted iterator, views (slice/stride), and iterator category upgrades (input→forward→random access). Benchmarks expose sharp costs — shuffling 5M elements is ~30ms for vector, ~38ms for deque, ~11.5 hours for list — and the lazy view approach succeeds in clearer, composable parsing.
AI-written summary · about
chapters (24)
- 0:00Intro
- 6:55Agenda
- 8:32Definition
- 11:27Linear Search
- 14:10Iterators
- 15:14Span
- 18:02Counted Iterator
- 19:52Sentinel
- 21:50Input Range
- 22:51Common Range
- 24:53Forward Iterator
- 26:42Equal Iterator
- 29:47Naive Shuffle
- 31:00Random Access Iterator
- 32:10Continuous Ranges
- 34:10Collatz conjecture
- 36:16Range as equal
- 37:03Spinto views
- 38:29What is a view
- 39:06Which views are in the namespace
- 39:58What is the significance of enable view
- 43:09Slice view
- 44:30Take and drop
- 49:05Strap you
related talks
01h 02mC++20 Ranges in Practice
01h 06mC++20 Ranges in Practice
01h 25mC++23 Ranges: Conceptual Changes and Useful Practicalities
01h 36mC++ Standard Views
01h 34mAn Overview of Standard Ranges
01h 13mFrom Iterators to Ranges — the Upcoming Evolution of the Standard Library
59mRange-Based Text Formatting - For a Future Range-Based Standard Library
38mWhat's New In C++23
