Closed tremmelg closed 6 years ago
The bug here is that view::slice
incorrectly believes that the bounded range [it, it + count)
is equivalent to the counted range [it, count)
when it
is a RandomAccessIterator
(See https://github.com/ericniebler/range-v3/blob/master/include/range/v3/view/slice.hpp#L142). I suggest replacing view::slice(first, last)
with view::drop(first) | view::take(last - first)
as a workaround until we get this fixed (a la https://wandbox.org/permlink/TbXQsmx0YfvQcRKj).
Composing
ranges::view::cycle
withranges::view::slice
results in a view that returns begin and endpoints that compare equal. On the other hand,ranges::distance
returns the expected 512. Also, see the example below.Compiling the above example against 2ff4cf2 and running it gives: