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.

llvm-svn: 232097
This commit is contained in:
David Blaikie 2015-03-12 20:18:10 +00:00
parent 7f29cf5770
commit f1f52512ea
1 changed files with 5 additions and 6 deletions

View File

@ -129,14 +129,13 @@ public:
class atom_iterator : public std::iterator<std::forward_iterator_tag, T> { class atom_iterator : public std::iterator<std::forward_iterator_tag, T> {
public: public:
atom_iterator(const atom_collection<T> &c, const void *it) atom_iterator(const atom_collection<T> &c, const void *it)
: _collection(c), _it(it) { } : _collection(&c), _it(it) { }
const T *operator*() const { const T *operator*() const {
return _collection.deref(_it); return _collection->deref(_it);
} }
const T *operator->() const { 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) { friend bool operator==(const atom_iterator<T> &lhs, const atom_iterator<T> &rhs) {
@ -148,11 +147,11 @@ public:
} }
atom_iterator<T> &operator++() { atom_iterator<T> &operator++() {
_collection.next(_it); _collection->next(_it);
return *this; return *this;
} }
private: private:
const atom_collection<T> &_collection; const atom_collection<T> *_collection;
const void *_it; const void *_it;
}; };