World Congress 2024

Why Iterators Got It All Wrong β€” and what we should use instead

July 18, 2024 10:50 – 11:20 Β· 30 min STAGE 10 (120)

What this session covers

You understand iterators, right? How would you describe them? β€œIterators are used to point into sequences of elements.” Sounds good? More recently, the concept of ranges has been introduced to mean anything that exposes iterators. In particular, ranges include range adaptors for lazily transforming or filtering sequences of elements, and they, too, have iterators. All good? Unfortunately, not. The iterator concept, which we have been using since the advent of C++, is fundamentally flawed. In particular, some iterators must behave differently depending on whether they are meant to point at an element or at a boundary between elements. So elements and boundaries are really two distinct concepts. In this talk, I will convince you that the problem is real and has practical implications, make a proposal on how to fix it and show how the solution not only fixes the problem but makes for clearer code and prevents mistakes.

Related talks at this congress

Open session

World Congress 2024

July 18, 2024 Β· 10:10–10:40

STAGE 10 (120)

An (In-)Complete Guide to C++ Object Lifetimes

Jonathan MΓΌller

Software Engineer

JM
Open session

World Congress 2024

July 19, 2024 Β· 11:00–11:30

STAGE 6 (120)

Traits in Rust - Not Your Grandparents' Interfaces

Rainer Stropek

software architects

Rainer Stropek
Open session

World Congress 2024

July 19, 2024 Β· 11:40–12:10

STAGE 2 (500)

Algebraic Data Types + Pattern Matching = Elegant and readable Java code

Balkrishna Rawool

IT Chapter Lead at ING Bank NV

Balkrishna Rawool
Open session

World Congress 2024

July 19, 2024 Β· 10:20–10:50

Virtual Stage 2

Are you done yet? Mastering long-running processes in modern architectures

Bernd Ruecker

Co-Founder and Chief Technologist

Bernd Ruecker
All sessions at this congress