Openness to a "zip_iterator" type?

One of my coworkers noticed that we(Clang/LLVM) have quite a few places where we need to iterate through 2 equally sized ranges at the same time, often related to parm/arg relationships. In a few cases we(Clang/LLVM) use a traditional for-loop with 2 iterators in it. In a few others, the implementation uses range-for over 1 range with an iterator pattern on the other.

IMO, the correct solution to this would be a templated 'zip' type (similar, though not identical to Zip Iterator - 1.62.0) that would permit:

for (auto&& things : IteratorZip(ParmRange, ArgRange)) {
[CurParm, CurArg] = things; // things is a tuple that contains a reference to each value

If I were to implement this IteratorZip type for the LLVM codebase, would this be something the community would be interested in/accept/use? Am I missing an obvious existing implementation somewhere?


Yes: include/llvm/ADT/STLExtras.h has zip.
See also unittests/ADT/IteratorTest.cpp.

Inline post, sorry for the formatting, Outlook is terrible for editing mailing lists