[PATCH] D78073: [STLExtras] Make const the * operator for mapped_iterator.

Alina Sbirlea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 14 11:18:21 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGd5fcb7966e0e: [STLExtras] Make const the * operator for mapped_iterator. (authored by asbirlea).

Repository:
  rG LLVM Github Monorepo

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

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.257417.patch
Type: text/x-patch
Size: 965 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200414/d37e4ff4/attachment.bin>


More information about the llvm-commits mailing list