
Sequence-Oriented Programming
CppCast
00:00
How to Use Range-Based for Loops to Be Safe in C++
In C++, if you do like a traditional for loop, there are four operations. At pretty much any of those stages, I think apart from the comparison with end, you can get undefined behavior. But then we also have like range-based for loops, which are kind of safe. And we have like ranges and views, which are, I think, kind of safe as well. The idea behind flux is to replace these low-level iterate operations with a different iteration scheme that doesn't allow undefined behavior.
Transcript
Play full episode