for (const auto& [x, y] = std::views::zip(a, b)) {
/* ... */
}
A notable difference is that the ranges don't have to match in size, the loop will run until the end of the shorter range is reached.If it is required for optimization to not check for reaching the end of one of the ranges then it can be achieved with something like:
for (const auto& [x, y] = std::views::zip(a, std::ranges::subrange(std::ranges::begin(b), std::unreachable_sentinel))) {
/*...*/
}
I guess it's hard enough to bump into this by accident.