Daily bit(e) of C++ | std::ranges::fold_left_with_iter, std::ranges::fold_left_first_with_iter
Daily bit(e) of C++ #137, The C++23 fold algorithms for sentinel ranges: std::ranges::fold_left_with_iter, std::ranges::fold_left_first_with_iter.
The std::ranges::fold_left_with_iter and std::ranges::fold_left_first_with_iter are alternative versions of the fold_left algorithms that additionally return the computed end iterator.
This comes in handy in cases where the range is terminated using a sentinel. The computed end iterator can then be re-used and doesn't have to be re-calculated.