-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
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
Combining reversed with zip (and possibly others) #40
Comments
All of the itertools have zip(reversed(container1), reversed(container2)) |
Thank you for your quick answer! The code you proposed works in my situation. I will have a look if I can find a general solution involving rend() and rbegin() but I have little experience in heavy template usage. |
it's pretty heavy. The SFINAEing involved will need to be pretty precise if I'm picturing this correctly. Reversing is also non-obvious for many itertools. For example, consider the case where std::vector<int> v = {1, 2, 3};
std::string s{"abcdef"}; If you zip this
If you reverse it
but that doesn't match
|
I think in case of containers of different length it would be ok if the two versions with reversed() differ, as long as the rules of how they work/differ are clear. I realized I won't have the time to work on an implementation right now and my problem has been solved, so I will close this issue. Thanks for your help! |
I tried to use reversed in conjunction with zip in a ranged-based for loop, i.e.
for (auto&& tup : reversed(zip(container1, container2))) { ... }
Unfortunately, this results in error messages stating that there is no rbegin() function. Indeed, I didn't find that function in zip.hpp. Are there any plans to add this functionality, possibly also to the other range expressions?
The text was updated successfully, but these errors were encountered: