We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling ranges::distance with a ranges::zip_view that has an infinite view component gives different results depending on the specific infinite view.
ranges::distance
ranges::zip_view
#include <range/v3/all.hpp> #include <vector> #include <iostream> int main() { std::vector<int> input(1024); auto cycle = ranges::view::cycle(input); auto zip_cycle = ranges::view::zip(input, cycle); std::cout << "Cycle: " << ranges::distance(zip_cycle) << "\n"; auto repeat = ranges::view::repeat(42); auto zip_repeat = ranges::view::zip(input, repeat); std::cout << "Repeat: " << ranges::distance(zip_repeat) << "\n"; auto iota = ranges::view::iota(0); auto zip_iota = ranges::view::zip(input, iota); std::cout << "Iota: " << ranges::distance(zip_iota) << "\n"; auto generate = ranges::view::generate([]() { return 42; }); auto zip_generate = ranges::view::zip(input, generate); std::cout << "Generate: " << ranges::distance(zip_generate) << "\n"; }
Compiling the above example against 2ff4cf2 and running it gives:
% ./zip_distance Cycle: 0 Repeat: 0 Iota: 1024 Generate: 1024
The text was updated successfully, but these errors were encountered:
abandon the cyclic iterator experiment as a hopeless bug farm; fixes #…
9bf5396
…783, fixes #780, fixes #778
ec615c7
Successfully merging a pull request may close this issue.
Calling
ranges::distance
with aranges::zip_view
that has an infinite view component gives different results depending on the specific infinite view.Compiling the above example against 2ff4cf2 and running it gives:
The text was updated successfully, but these errors were encountered: