diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-31 14:14:09 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-31 14:14:09 +0100 |
commit | f8d8d7499ba4433678db2a68fb1cae74448ca31e (patch) | |
tree | fc96bef89fc3206277d1fcf1e3df5ad733b7e652 /backend/List.hpp | |
parent | a0e14fa424494ed35da1bd6e5e54bb36178259a7 (diff) |
make ListIterator continue working on a changing list
Diffstat (limited to 'backend/List.hpp')
-rw-r--r-- | backend/List.hpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/backend/List.hpp b/backend/List.hpp index 25e7a56..634f14b 100644 --- a/backend/List.hpp +++ b/backend/List.hpp @@ -8,7 +8,7 @@ size_t List<T>::size() const { } template <typename T> -void List<T>::push_back(T & el) { +void List<T>::push_back(const T & el) { ListLink<T> * link = new ListLink<T> { .prev = this->head, .next = nullptr, @@ -78,17 +78,17 @@ T & List<T>::operator [] (size_t index) const { } template <typename T> -ListRange<T> List<T>::range() const { +ListRange<T> List<T>::range() { return { *this }; } template <typename T> -ListIterator<T> List<T>::begin() const { +ListIterator<T> List<T>::begin() { return this->range().begin(); } template <typename T> -ListIterator<T> List<T>::end() const { +ListIterator<T> List<T>::end() { return this->range().end(); } |