C++20 range based for-loop with initializer statement

Gajendra Gulgulia
3 min readJan 18, 2023

Range based for loop with initializer statements are to range based for loop in C++20 what if statements with initializer statements are to if-else in C++17. If you are Proponent of using clean C++ with modern syntax, then chances are high that the pre-C++20 version of range based for-loop must have limited you at some point.

This article is not about how range based for loop work, for which there are many discussions online including this SO post which goes into the verbose technicalities.

Range based for-loop…

--

--