[PATCH] D78073: [STLExtras] Make const the * operator for mapped_iterator.
Alina Sbirlea via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 13 19:34:07 PDT 2020
asbirlea created this revision.
asbirlea added reviewers: mehdi_amini, rriddle, dblaikie, timshen.
Herald added subscribers: frgossen, grosul1, Joonsoo, liufengdb, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, burmako, jpienaar, dexonsmith.
Herald added 1 blocking reviewer(s): rriddle.
Herald added a project: LLVM.
The current non-const * operator shadows the const operator in
iterator_adaptor_base.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D78073
Files:
llvm/include/llvm/ADT/STLExtras.h
mlir/include/mlir/IR/Attributes.h
Index: mlir/include/mlir/IR/Attributes.h
===================================================================
--- mlir/include/mlir/IR/Attributes.h
+++ mlir/include/mlir/IR/Attributes.h
@@ -228,7 +228,7 @@
explicit attr_value_iterator(ArrayAttr::iterator it)
: llvm::mapped_iterator<ArrayAttr::iterator, AttrTy (*)(Attribute)>(
it, [](Attribute attr) { return attr.cast<AttrTy>(); }) {}
- AttrTy operator*() { return (*this->I).template cast<AttrTy>(); }
+ AttrTy operator*() const { return (*this->I).template cast<AttrTy>(); }
};
public:
Index: llvm/include/llvm/ADT/STLExtras.h
===================================================================
--- llvm/include/llvm/ADT/STLExtras.h
+++ llvm/include/llvm/ADT/STLExtras.h
@@ -214,7 +214,7 @@
ItTy getCurrent() { return this->I; }
- FuncReturnTy operator*() { return F(*this->I); }
+ FuncReturnTy operator*() const { return F(*this->I); }
private:
FuncTy F;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78073.257182.patch
Type: text/x-patch
Size: 965 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200414/04028386/attachment.bin>
More information about the llvm-commits
mailing list