This function follows std::ranges::size from C++20. It is intended
mainly for generic code that does not know the exact range type.
I did not modify the existing llvm::size function because it has a strict
guarantee of O(1) running time, and we cannot guarantee that when we delegate
size check to user-defined size functions.
Use range_size to optimize size checks in zip* and enumerate
functions. Before that, we would have to perform linear scans for ranges
without random access iterators.
This is the last change I have planned in the series that overhauls
zip* and enumerate.
Rather than detecting both member and non-member, could we standardize on non-member, like adl_begin/adl_end works? Could expose adl_size to match adl_begin/end too, in addition to this wrapper that has the fallback to distance.