Lightning Talk: Unlocking More Ways To Use Range-Based For
summary
Builds a working C++ enumerate by composing a pseudo iterator that holds a counter plus the original iterator, implements ++, != (comparing only the underlying iterator), and dereference to yield index and element, and exposes begin/end so range-based for accepts it. Diagnoses a lifetime bug where temporaries used to construct the range die before iteration and notes brace-init issues; shows fixes, supports begin+size wrappers, key-only or value-only dereference, and returning the raw iterator for in-loop erase — all shown to work.
AI-written summary · about
chapters (7)
- 0:00Introduction
- 0:56enumerate
- 1:20Range Base 4
- 3:08The Problem
- 3:51The BeginningEnd
- 4:18End Size
- 4:32return intersect
related talks
01h 11mRanges++: Are Output Range Adaptors the Next Iteration of C++ Ranges?
07mLightning Talk: Higher-Order Template Metaprogramming with C++23
01h 01mUsing the filter view in practice
06mLightning Talk: C++20 - A New Way of Meta-Programming?
05mLightning Talks: -std=c++20 -- Will This C++ Code Compile?
01h 04mC++ Concepts
01h 02mDiscovering a User-Facing Concept
59mCute C++ Tricks, Part 2.5 of N - Code You Should Learn From & Never Write
