wrong value_type of stream iterators
Following the example, if I have
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 const it = rng_stream.begin();
I expect the value_type
of the iterator type (decltype(it)::value_type
) to be double
. It is unsigned long, though
.
Another way to phrase the problem is that
static_assert(std::is_same_v<decltype(it)::value_type, *decltype(it)>)
fails.
This becomes important, for instance, when you create a vector with automatically deduced type from a pair of iterators, e.g. auto vec = std::vector{it, std::next(it, 20)}
, which should contain the first 20 numbers of the stream. However, it contains the numbers truncated to integers.