Fixed DoublyLinkedList::Iterator().
Switched back to a pointer to the list in the Iterator internally, so that it can still be just copied without having to overload "=", etc. This fixes the boot loader build, too (shame on me). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6941 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
03d14a728a
commit
3f7d503ff1
@ -69,7 +69,7 @@ class List {
|
||||
|
||||
IteratorType Iterator()
|
||||
{
|
||||
return IteratorType(this);
|
||||
return IteratorType(*this);
|
||||
}
|
||||
|
||||
bool IsEmpty()
|
||||
@ -82,7 +82,6 @@ class List {
|
||||
return fLink.next;
|
||||
}
|
||||
|
||||
|
||||
static inline size_t Offset()
|
||||
{
|
||||
return (size_t)&(((Item *)1)->*LinkMember) - 1;
|
||||
@ -104,11 +103,11 @@ class Iterator {
|
||||
typedef List<Item, LinkMember> ListType;
|
||||
|
||||
Iterator() : fCurrent(NULL) {}
|
||||
Iterator(ListType &list) : fList(list), fCurrent(list.Head()) {}
|
||||
Iterator(ListType &list) : fList(&list), fCurrent(list.Head()) {}
|
||||
|
||||
Item *Next()
|
||||
{
|
||||
if (fCurrent == &fList.fLink)
|
||||
if (fCurrent == &fList->fLink)
|
||||
return NULL;
|
||||
|
||||
Link *current = fCurrent;
|
||||
@ -118,7 +117,7 @@ class Iterator {
|
||||
}
|
||||
|
||||
private:
|
||||
ListType &fList;
|
||||
ListType *fList;
|
||||
Link *fCurrent;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user