[PATCH] D144503: [WIP][STLExtras] Allow `llvm::enumerate` to enumerate over multiple ranges

Jakub Kuderski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 21 09:18:18 PST 2023


kuhar created this revision.
kuhar added reviewers: dblaikie, kazu, beanz, antiagainst, mravishankar, dcaballe, zturner, mehdi_amini.
Herald added a subscriber: hanchung.
Herald added a project: All.
kuhar requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This does not work by a mere composition of `enumerate` and `zip_equal`,
because C++17 does not allow for recursive expansion of structured
bindings.

This implementation uses `zippy` to manage the iteratees and adds the
stream of indices as the first zipped range. Because we have an upfront
assertion that all input ranges are of the same length, we only need to
check if the second range has ended during iteration.

I marked this as 'Work In Progress' because I'm not sure if there's a
simpler/cleaner implementation. I'd really appreciate some suggestions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D144503

Files:
  llvm/include/llvm/ADT/STLExtras.h
  llvm/unittests/ADT/STLExtrasTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144503.499208.patch
Type: text/x-patch
Size: 21907 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230221/79ebedca/attachment.bin>


More information about the llvm-commits mailing list