[PATCH] D144503: [ADT] Allow `llvm::enumerate` to enumerate over multiple ranges
Jakub Kuderski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 13 12:40:11 PDT 2023
kuhar added inline comments.
================
Comment at: llvm/include/llvm/ADT/STLExtras.h:2282-2283
+struct index_stream {
+ struct iterator : iterator_facade_base<iterator, std::forward_iterator_tag,
+ const iterator> {
+ std::size_t operator*() const { return Index; }
----------------
dblaikie wrote:
> Could this be conforming/have a real reference type (& Return ref from op*)?
I looked into returning the reference to the index but this breaks the requirement of references being valid as long as the range is valid:
> Pointers and references obtained from a forward iterator into a range remain valid while the range exists.
I kept this as-is and added a comment.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144503/new/
https://reviews.llvm.org/D144503
More information about the llvm-commits
mailing list