Loop Exit Blocks: A proposal for C++20
summary
Proposal for an end-of-loop syntax that attaches two optional blocks: one runs when a loop finishes naturally and one runs when it exits by break. Concrete claims: enables range-based for over rvalue containers by providing lifetime extension of the loop’s initializer, removes the need for awkward lambdas, gotos, or duplicating tests, and makes patterns like “find-and-erase or assert if not found” expressible without moving the loop body into a helper function.
AI-written summary · about
related talks
01h 03m“Implementing `static` control flow in C++14"
01h 02mImplementing `static` control flow in C++14
20mMisconceptions About Loops in C
01h 35mC++20 – My Favourite Code Examples
01h 02mC++20 Ranges in Practice
01h 02mC++20 - My Favourite Code Examples
05mYou must type it three times
59mC++20 - My Favourite Code Examples
