[PATCH] D106605: Add `all_of_zip` to STLExtras

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 27 11:11:36 PDT 2021


mehdi_amini added a comment.

> What about if the range itself was boolean testable (or had some "areBothRangesTraversed" operation or the like) that could be queried (assert-fails if queried early) after the zip has reached the end (and in that case the end would be the end of either range, whichever comes first)?

That's interesting: the range itself is disconnected from the iterator state though, so I don't think you could just query the range.

The best I can think of would be something that would end-up looking like:

  auto range = zip(a, b, c);
  auto it = range.begin();
  for (; it != range.end(); ++it) {
     ...
  }
  if (!it.all_equals(range.end())  // bike shed the API name
     // error


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106605/new/

https://reviews.llvm.org/D106605



More information about the llvm-commits mailing list