Custom Views for the Rest of Us
summary
Implements an all_pairs view that lazily presents every ordered pair (except the diagonal) and uses it to compute pairwise gravitational forces for a toy solar‑system; shows the iterator + sentinel layout, why the outer iterator returns a proxy‑like reference, and how proxy iterators force custom iter_move/iter_swap and common_reference workarounds. Code is slide‑ready and works but isn’t production hardened: custom views can’t be piped pre‑C++23 and proxies can break old generic algorithms, so prefer std::ranges or range‑v3 until fixes land.
AI-written summary · about
chapters (24)
- 0:00Start
- 2:36Motivating Example
- 3:31Gravitational Range
- 8:06Range Adapter Pipeline
- 9:05Adapter and Range Factory
- 9:36Range Factory
- 10:15Nested for Loop
- 10:27Description
- 10:51The Template Signature
- 11:48The Constructor
- 12:26Iterator Types
- 13:50Ignore Pairs of Matching Elements
- 14:04The Constructor and the Dereference Operator
- 16:39Why Use Extensional At All
- 19:26Vector of Bool
- 22:12Proxy Iterator
- 24:00Customization Point Object
- 25:55Swap and Intermove
- 30:21Common Reference
- 35:19The Range Adapter Closure Object
- 36:43The Range Adapter Object
- 38:38Type Range Adapter Closure
- 40:23Conclusion
- 40:56Proxies








