What a View! Building Your Own (Lazy) Range Adaptors (part 2 of 2)
summary
Implements a non‑standard lazy range adaptor called stride_view that skips elements by a user step, including a hand‑rolled iterator type, sentinel handling, and a compute_distance routine that adjusts size (e.g. every 33rd of 100 yields 67,34,1). Adds const‑qualified overloads to avoid race issues, supports front/back/subscript for common/sized ranges, composes with views::reverse, and exposes a range adaptor closure so piping works. Tests compile and pass on MSVC preview (examples and source are on the CppCon repo).
AI-written summary · about
chapters (8)
- 0:00Introduction and recap
- 10:36Implementing stride view
- 28:27Testing and filter view issues
- 36:01Fixing const-qualified ranges
- 42:52Common range and element access
- 46:46Reverse iteration and composition
- 47:27Range adapter closures
- 55:13Conclusion and Q&A
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 09mMissing (and future?) C++ Range Concepts
01h 09mRe-Release: Missing (and future?) C++ Range Concepts
01h 15mHow to Rangify Your Code
