Fixed compilation

svn-id: r18745
This commit is contained in:
Chris Apers 2005-09-03 16:10:08 +00:00
parent 09b0f765d4
commit 1dc00deb56

View File

@ -28,7 +28,7 @@ namespace Common {
/**
* Simple double linked list, modelled after the list template of the standard
* C++ library.
* C++ library.
*/
template <class T>
class List {
@ -41,11 +41,11 @@ public:
NodeBase *_prev;
NodeBase *_next;
};
template <class T2>
struct Node : public NodeBase {
T2 _data;
Node<T2>(const T2 &x) : _data(x) {}
};
@ -54,7 +54,12 @@ public:
friend class List<T>;
NodeBase *_node;
#ifndef PALMOS_MODE
explicit Iterator<T2>(NodeBase *node) : _node(node) {}
#else
Iterator<T2>(NodeBase *node) : _node(node) {}
#endif
public:
Iterator<T2>() : _node(0) {}
@ -91,11 +96,11 @@ public:
T2* operator->() const {
return &(operator*());
}
bool operator==(const Iterator<T2>& x) const {
return _node == x._node;
}
bool operator!=(const Iterator<T2>& x) const {
return _node != x._node;
}
@ -141,7 +146,7 @@ public:
void insert(iterator pos, const T& element) {
NodeBase *newNode = new Node<T>(element);
newNode->_next = pos._node;
newNode->_prev = pos._node->_prev;
newNode->_prev->_next = newNode;
@ -167,8 +172,15 @@ public:
}
iterator erase(iterator first, iterator last) {
while (first != last)
while (first != last) {
#ifndef PALMOS_MODE
erase(first++);
#else
iterator tmp = first._node->_next;
erase(first);
first = tmp;
#endif
}
return last;
}
@ -196,7 +208,7 @@ public:
else
erase(i, end());
}
return *this;
}
@ -210,8 +222,8 @@ public:
void clear() {
erase(begin(), end());
}
bool isEmpty() const {
bool isEmpty() const {
return (_anchor == _anchor->_next);
}