diff options
author | Chris Apers | 2005-09-03 16:10:08 +0000 |
---|---|---|
committer | Chris Apers | 2005-09-03 16:10:08 +0000 |
commit | 1dc00deb561e7eaf8654924fa4698cd9faed8405 (patch) | |
tree | b8b8572508a0cc172643d41b6412ad070680d51e /common | |
parent | 09b0f765d4a3b4d726d440182fb4e7fdcb5d805f (diff) | |
download | scummvm-rg350-1dc00deb561e7eaf8654924fa4698cd9faed8405.tar.gz scummvm-rg350-1dc00deb561e7eaf8654924fa4698cd9faed8405.tar.bz2 scummvm-rg350-1dc00deb561e7eaf8654924fa4698cd9faed8405.zip |
Fixed compilation
svn-id: r18745
Diffstat (limited to 'common')
-rw-r--r-- | common/list.h | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/common/list.h b/common/list.h index bd1be508d7..b6fa676f2d 100644 --- a/common/list.h +++ b/common/list.h @@ -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); } |