[lld] r232097 - Make the atom_iterator copy assignable

David Blaikie dblaikie at gmail.com
Thu Mar 12 13:18:10 PDT 2015


Author: dblaikie
Date: Thu Mar 12 15:18:10 2015
New Revision: 232097

URL: http://llvm.org/viewvc/llvm-project?rev=232097&view=rev
Log:
Make the atom_iterator copy assignable

This makes it a bit more like a 'real' iterator though I still haven't
gone through to make sure it meets the full requirements. Copy
assignability seems to be required by MSVC's std::find_if, which is its
right.

Modified:
    lld/trunk/include/lld/Core/File.h

Modified: lld/trunk/include/lld/Core/File.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/File.h?rev=232097&r1=232096&r2=232097&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/File.h (original)
+++ lld/trunk/include/lld/Core/File.h Thu Mar 12 15:18:10 2015
@@ -129,14 +129,13 @@ public:
   class atom_iterator : public std::iterator<std::forward_iterator_tag, T> {
   public:
     atom_iterator(const atom_collection<T> &c, const void *it)
-              : _collection(c), _it(it) { }
+              : _collection(&c), _it(it) { }
 
     const T *operator*() const {
-      return _collection.deref(_it);
+      return _collection->deref(_it);
     }
     const T *operator->() const {
-
-      return _collection.deref(_it);
+      return _collection->deref(_it);
     }
 
     friend bool operator==(const atom_iterator<T> &lhs, const atom_iterator<T> &rhs)  {
@@ -148,11 +147,11 @@ public:
     }
 
     atom_iterator<T> &operator++() {
-      _collection.next(_it);
+      _collection->next(_it);
       return *this;
     }
   private:
-    const atom_collection<T> &_collection;
+    const atom_collection<T> *_collection;
     const void               *_it;
   };
 





More information about the llvm-commits mailing list