range-v3
range-v3 copied to clipboard
extra increment on ranges::copy_n compared to other standard implementations
See also: https://cplusplus.github.io/LWG/issue2471
The extra trailing increment on ranges::copy_n causes trouble when you use it with an istream_iterator source, as istream_iterator performs an irreversible action on increment.
Essentially, this will consume 6 ints from the source stream, instead of 5:
ranges::copy_n(std::istream_iterator<int>(is), 5, dest);
A similar issue exists with copy, take, and istream_view - the following will consume 6 ints from the source stream also:
ranges::copy(ranges::istream_view<int>(is) | views::take(5), dest);