How to break or continue from a lambda loop? -- Vittorio Romeo
Is it possible to write a simple iteration API that hides implementation details and lets users break and continue?
Here's a new article about a lightweight solution using a `ControlFlow` enumeration!
How to break or continue from a lambda loop?
by Vittorio Romeo
From the article:
Here’s an encapsulation challenge that I frequently run into: how to let users iterate over an internal data structure without leaking implementation details, but still giving them full control over the loop?
Implementing a custom iterator type requires significant boilerplate and/or complexity, depending on the underlying data structure.
Coroutines are simple and elegant, but the codegen is atrocious – definitely unsuitable for hot paths.


Registration is now open for CppCon 2025! The conference starts on September 13 and will be held
Constexpr has been around for a while now, but many don’t fully understand its subtleties. Andreas Fertig explores its use and when a constexpr expression might not be evaluated at compile time.
C++’s undefined behaviour impacts safety. Sandor Dargo explains how and why uninitialised reads will become erroneous behaviour in C++26, rather than being undefined behaviour.
In the December issue of Overload [