It appears that the range-v3 iota_view iterator is not random access when you use a 64 bit type for the initial value. It works ok for gcc iota_view. It works for range-v3 with a 32 bit initial value. Here is a simple example in compiler explorer: https://godbolt.org/z/dEG7aKnoc. It uses gcc 13 and trunk for range-v3. I also list the code below.
Is there a way to make it be random access?
#if 1
// range v3
#include <range/v3/all.hpp>
namespace rng = ::ranges;
#else
#include <ranges>
namespace rng = std::ranges;
#endif
int main()
{
// works
// int base = 100;
// does not work
//std::size_t base = 100;
//long base = 100;
ssize_t base = 100;
static_assert(std::random_access_iterator<decltype(rng::begin(rng::views::iota(base)))>);
}
A local C++ expert had the answer. Use
rng::random_access_iteratorinstead ofstd::random_access_iterator.