Daily bit(e) of C++ | std::counted_iterator
Daily bit(e) of C++ #92, The C++20 counted iterator adapter: std::counted_iterator
Only a few algorithms in the standard library offer counted variants that operate using a begin iterator and the number of elements.
C++20 introduced the std::counted_iterator adapter that can turn any range version of an algorithm into a counted variant.