aboutsummaryrefslogtreecommitdiff
path: root/common/list.h
diff options
context:
space:
mode:
authorMax Horn2003-10-05 14:02:28 +0000
committerMax Horn2003-10-05 14:02:28 +0000
commit6e73fffcfad1e607db473004f3c6e718ecdebdc4 (patch)
tree7f409e63186550390e133c347c80597134ec52a0 /common/list.h
parent8cb0c8c3204b75685dfc6f25d8ac9e49e6c52545 (diff)
downloadscummvm-rg350-6e73fffcfad1e607db473004f3c6e718ecdebdc4.tar.gz
scummvm-rg350-6e73fffcfad1e607db473004f3c6e718ecdebdc4.tar.bz2
scummvm-rg350-6e73fffcfad1e607db473004f3c6e718ecdebdc4.zip
added iterators to List template
svn-id: r10607
Diffstat (limited to 'common/list.h')
-rw-r--r--common/list.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/common/list.h b/common/list.h
index 4b3f5a20c2..7d7ccb0283 100644
--- a/common/list.h
+++ b/common/list.h
@@ -34,6 +34,10 @@ protected:
T *_data;
public:
+ typedef T *Iterator;
+ typedef const T *ConstIterator;
+
+public:
List<T>() : _capacity(0), _size(0), _data(0) {}
List<T>(const List<T>& list) : _capacity(0), _size(0), _data(0) {
_size = list._size;
@@ -108,6 +112,23 @@ public:
return (_size == 0);
}
+
+ Iterator begin() {
+ return _data;
+ }
+
+ Iterator end() {
+ return _data + _size;
+ }
+
+ ConstIterator begin() const {
+ return _data;
+ }
+
+ ConstIterator end() const {
+ return _data + _size;
+ }
+
protected:
void ensureCapacity(int new_len) {
if (new_len <= _capacity)