From 6e73fffcfad1e607db473004f3c6e718ecdebdc4 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 5 Oct 2003 14:02:28 +0000 Subject: added iterators to List template svn-id: r10607 --- common/list.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'common/list.h') diff --git a/common/list.h b/common/list.h index 4b3f5a20c2..7d7ccb0283 100644 --- a/common/list.h +++ b/common/list.h @@ -33,6 +33,10 @@ protected: int _size; T *_data; +public: + typedef T *Iterator; + typedef const T *ConstIterator; + public: List() : _capacity(0), _size(0), _data(0) {} List(const List& list) : _capacity(0), _size(0), _data(0) { @@ -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) -- cgit v1.2.3