[PATCH] D106605: Add `all_of_zip` to STLExtras
David Blaikie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 27 05:46:58 PDT 2021
dblaikie added a comment.
In D106605#2905907 <https://reviews.llvm.org/D106605#2905907>, @mehdi_amini wrote:
> The issue is that I think the "expected" way in C++ to have a zip operator that fails when the length mismatch is to use exceptions. I'm not how else to have a range that can fail when iterated on?
Yeah, while keeping the iterator interface (rather than using a different interface, which would then be less composable) and with arbitrary elements (so you can't construct a default/failed object) it's a bit limited.
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)?
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