[llvm] r302257 - Allow operator-> to work from a FixedStreamArrayIterator.

Adrian McCarthy via llvm-commits llvm-commits at lists.llvm.org
Fri May 5 10:14:00 PDT 2017


Author: amccarth
Date: Fri May  5 12:14:00 2017
New Revision: 302257

URL: http://llvm.org/viewvc/llvm-project?rev=302257&view=rev
Log:
Allow operator-> to work from a FixedStreamArrayIterator.

This is similar to my recent fix for VarStreamArrayIterator, but the cause
(and thus the fix) is subtley different.  The FixedStreamArrayIterator
iterates over a const Array, so the iterator's value type must be const.

Modified:
    llvm/trunk/include/llvm/Support/BinaryStreamArray.h

Modified: llvm/trunk/include/llvm/Support/BinaryStreamArray.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/BinaryStreamArray.h?rev=302257&r1=302256&r2=302257&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/BinaryStreamArray.h (original)
+++ llvm/trunk/include/llvm/Support/BinaryStreamArray.h Fri May  5 12:14:00 2017
@@ -342,7 +342,7 @@ private:
 template <typename T>
 class FixedStreamArrayIterator
     : public iterator_facade_base<FixedStreamArrayIterator<T>,
-                                  std::random_access_iterator_tag, T> {
+                                  std::random_access_iterator_tag, const T> {
 
 public:
   FixedStreamArrayIterator(const FixedStreamArray<T> &Array, uint32_t Index)
@@ -356,6 +356,7 @@ public:
   }
 
   const T &operator*() const { return Array[Index]; }
+  const T &operator*() { return Array[Index]; }
 
   bool operator==(const FixedStreamArrayIterator<T> &R) const {
     assert(Array == R.Array);




More information about the llvm-commits mailing list