SinglyLinkedList: The sole Iterator is really ConstIterator.

It behaves the same way as DoublyLinkedList's ConstIterator,
so let's name it the same way for consistency.
This commit is contained in:
Augustin Cavalier
2024-09-04 14:15:20 -04:00
parent 3e6902c3f4
commit df44e515de
17 changed files with 36 additions and 36 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ private:
class PathBlocklist {
public:
typedef SinglyLinkedList<BlockedPath>::Iterator Iterator;
typedef SinglyLinkedList<BlockedPath>::ConstIterator Iterator;
public:
PathBlocklist();
@@ -94,16 +94,16 @@ class SinglyLinkedList {
typedef SinglyLinkedListLink<Element> Link;
public:
class Iterator {
class ConstIterator {
public:
Iterator(const List* list)
ConstIterator(const List* list)
:
fList(list)
{
Rewind();
}
Iterator(const Iterator& other)
ConstIterator(const ConstIterator& other)
{
*this = other;
}
@@ -121,7 +121,7 @@ class SinglyLinkedList {
return element;
}
Iterator& operator=(const Iterator& other)
ConstIterator& operator=(const ConstIterator& other)
{
fList = other.fList;
fNext = other.fNext;
@@ -164,7 +164,7 @@ class SinglyLinkedList {
inline int32 Count() const;
// O(n)!
inline Iterator GetIterator() const { return Iterator(this); }
inline ConstIterator GetIterator() const { return ConstIterator(this); }
private:
Element *fFirst;