Index: src/utils.h |
diff --git a/src/utils.h b/src/utils.h |
index bd5589cc895196827e55e2ec8b245f087507329e..d1982b8282d39365d9ab09febbf88f40b7f9cf2f 100644 |
--- a/src/utils.h |
+++ b/src/utils.h |
@@ -1640,9 +1640,31 @@ class ThreadedList final { |
friend class ThreadedList; |
}; |
+ class ConstIterator final { |
+ public: |
+ ConstIterator& operator++() { |
+ entry_ = (*entry_)->next(); |
+ return *this; |
+ } |
+ bool operator!=(const ConstIterator& other) { |
+ return entry_ != other.entry_; |
+ } |
+ const T* operator*() const { return *entry_; } |
+ |
+ private: |
+ explicit ConstIterator(T* const* entry) : entry_(entry) {} |
+ |
+ T* const* entry_; |
+ |
+ friend class ThreadedList; |
+ }; |
+ |
Iterator begin() { return Iterator(&head_); } |
Iterator end() { return Iterator(tail_); } |
+ ConstIterator begin() const { return ConstIterator(&head_); } |
+ ConstIterator end() const { return ConstIterator(tail_); } |
+ |
void Rewind(Iterator reset_point) { |
tail_ = reset_point.entry_; |
*tail_ = nullptr; |