Tristan Brindle introduces Flux, a C++20 library designed to provide a safer alternative to standard STL iterators and avoid undefined behavior.
cppcon.org/
---
Iteration Revisited: A Safer Iteration Model for Cpp - Tristan Brindle - CppCon 2023
github.com/CppCon/CppCon2023
“Safety” is the word on everyone’s lips at the moment. Unfortunately for C++ programmers, one of our most fundamental abstractions — iterators — are fraught with danger. Prone to out-of-bounds memory accesses, unexpected invalidation and dangling, iterators are a UB minefield in which even experts can find themselves in trouble.
Fortunately there is something we can do about it.
In this talk we’ll look at an alternative, safer abstraction for iterating over sequences and introduce Flux, a new C++20 library implementing these ideas. We’ll see how Flux retains all of the power and flexibility of the existing STL, but greatly reduces the potential for UB through careful design and implementation choices — all while offering compatibility with existing code. We’ll also take a look at performance and examine the cost of universal bounds checking. Spoiler: it’s probably a lot less than you’d think. In fact, we’ll see how Flux code can actually outperform equivalent C++20 Ranges code in some common situations. Finally, we’ll take a quick look at some other quality-of-life improvements that Flux brings.
If you’re interested in the STL and the ranges and algorithms in C++20 and are looking for an easy-to-use way of making your codebase more resilient, then this is the talk for you.
---
Tristan Brindle
Tristan Brindle is a C++ consultant and trainer based in London. With over 15 years C++ experience, he started his career working in high-performance computing in the oil industry in Australia before returning home to his native UK in 2018. He is an active member of the ISO C++ Standards Committee (WG21) and the BSI C++ Panel. He is a regular speaker at C++ conferences around the world, and is a director of C++ London Uni, a non-profit organisation offering free introductory programming classes in London and online.
---
Work at Hudson River Trading (HRT): tinyurl.com/safxfctf
---
Videos Filmed & Edited by Bash Films: BashFilms.com
YouTube Channel Managed by Digital Medium Ltd: events.digital-medium.co.uk
---
Registration for CppCon: cppcon.org/registration/
#cppcon #cppprogramming #cpp
Why it's here
2 people recommend this
What people say. Recommended as an excellent talk on shifting from pointers to opaque handles for safer iteration in C++.
Moments people linked to
I
u/ImKStockyin r/gameenginedevs • Recommends
On “C++ what is a handle?”
To add to all the great other comments here, the topic of "handles" has become very relevant in the world of C++ lately with organisations like the NSA declaring it an unsafe language. This is a great talk about a library that shifts from using pointers as the iteration method, to using opaque handles. Definitely worth a watch.
On “Swift the best choice to succeed C++, Apple says”
C++ has been getting safer over the years. That keeps going with initiatives like this
[Iteration Revisited: A Safer Iteration Model for Cpp - Tristan Brindle - CppCon 2023 - YouTube]
I'm biased though as I'm building an on-line C++ code generator.