Closed PkXwmpgN closed 1 year ago
The distance between iterators is wrongly calculated when the first zipped range is empty:
std::vector<int> a = {1, 2, 3, 4, 5}; std::vector<int> b; auto z0 = zip(b, a); auto z1 = zip(a, b); auto d0 = ranges::distance(ranges::begin(z0), ranges::end(z0)); auto d1 = ranges::distance(ranges::begin(z1), ranges::end(z1)); assert(d0 == 0); // failed d0 == 5 assert(d1 == 0); // pass
With MSVC
std::vector<int> a = {1, 2, 3, 4, 5}; std::vector<int> b; auto v = zip(b, a) | ranges::to_vector; // access violation
Thanks for the fix!
The distance between iterators is wrongly calculated when the first zipped range is empty:
With MSVC