~/talk

Why Iterators Got It All Wrong — and what we should use instead

Talkat NDC TechTown 2024 · 2024-09-09..09-12· [c-and-cpp]
links:none on file
slides:none on file

Claim: C++ iterators mix two different semantics — elements and borders — which breaks adapter chaining (reverse, filter, transform) and makes base() ambiguous. Evidence: a 1M‑line code scan finds ~300 find uses with ≈200 acting as element pointers and ≈10–20 acting as borders, lower_bound mostly used to pick elements, upper_bound almost always used as a border. Fix: introduce distinct element/border iterator types, nullable elements, and dual base functions; implemented in the think cell range library and shown to work in practice.

AI-written summary · about

  1. 0:00Iterators introduction
  2. 3:17Iterator problems
  3. 6:32Transform adapter issues
  4. 9:44Filter adapter issues
  5. 13:40Reverse adapter issues
  6. 16:52Border-element identity problem
  7. 18:37Iterator roles in code
  8. 21:50Iterator nullability
  9. 24:17Elements versus borders
  10. 26:03Binary search with nulls
  11. 27:50Algorithm return specs
  12. 30:21Summary
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.