aboutsummaryrefslogtreecommitdiff
path: root/backend/List.h
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-31 14:14:09 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-31 14:14:09 +0100
commitf8d8d7499ba4433678db2a68fb1cae74448ca31e (patch)
treefc96bef89fc3206277d1fcf1e3df5ad733b7e652 /backend/List.h
parenta0e14fa424494ed35da1bd6e5e54bb36178259a7 (diff)
make ListIterator continue working on a changing list
Diffstat (limited to 'backend/List.h')
-rw-r--r--backend/List.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/backend/List.h b/backend/List.h
index 1af0b35..3bdbb23 100644
--- a/backend/List.h
+++ b/backend/List.h
@@ -10,6 +10,7 @@ class ListIterator;
template <typename T>
struct ListLink {
+ friend class ListIterator<T>;
ListLink<T> * prev;
ListLink<T> * next;
T value;
@@ -24,7 +25,7 @@ public:
public:
size_t size() const;
- void push_back(T & el);
+ void push_back(const T & el);
void remove(const T & val);
void pop_back();
@@ -33,11 +34,12 @@ public:
T & operator [] (size_t index) const;
- ListIterator<T> begin() const;
- ListIterator<T> end() const;
- ListRange<T> range() const;
+ ListIterator<T> begin();
+ ListIterator<T> end();
+ ListRange<T> range();
private:
+ friend class ListRange<T>;
ListLink<T> * head = nullptr;
ListLink<T> * tail = nullptr;
size_t length = 0;