Daily bit(e) of C++ | init statements
Daily bit(e) of C++ ♻️125, Creating local variables using init statements in if (C++17), switch (C++17) and range-for loop (C++20) statements.
Init statements enable fully encapsulated if, switch (C++17) and range-for-loop (C++20) statements by adding an init section in which we can create variables with a lifetime matching the statement block.
This reduces the pollution of names, allowing for more appropriately named local variables.