Daily bit(e) of C++ | std::views::enumerate
Daily bit(e) of C++ #136, The C++23 indexed view: std::views::enumerate.
The range-for-loop is a very convenient replacement for the C-style for-loop.
However, range-for-loop can be cumbersome when accessing the original index or computing a target index.
The C++23 std::views::enumerate removes this problem by producing a range of tuples, where the i-th tuple consists of the value i and a reference to the i-th element of the source range.