IAP GITLAB

Cannot create range from stream iterator

I'd like to be able to use random iterators with C++20 ranges. It is, however, impossible to create a range from a random iterator. Example:

#include <random>
#include <ranges>

#include <random_iterator/Stream.hpp>
int main() {
    random_iterator::philox rng(445);
    std::uniform_real_distribution<double> dist(0.0, 10.0);
    auto rng_stream = random_iterator::make_stream(dist, rng, 0);

    auto begin = rng_stream.begin();

    // this does not compile, should be a range of the first 8 numbers
    auto v = std::ranges::subrange(begin, 8);

    return 0;
}

compiler error with g++ 11.3:

test.cpp:13:44: error: class template argument deduction failed:
   13 |     auto v = std::ranges::subrange(begin, 8);