Added default iterator constructor, for convenience

svn-id: r13808
This commit is contained in:
Max Horn 2004-05-08 19:34:06 +00:00
parent 011173f18c
commit 7804b57632

View File

@ -50,31 +50,37 @@ protected:
struct Iterator {
NodeBase *_node;
Iterator<T2>() : _node(0) {}
Iterator<T2>(NodeBase *node) : _node(node) {}
// Prefix inc
Iterator<T2> &operator++() {
_node = _node->_next;
if (_node)
_node = _node->_next;
return *this;
}
// Postfix inc
Iterator<T2> operator++(int) {
Iterator<T2> tmp = *this;
_node = _node->_next;
if (_node)
_node = _node->_next;
return tmp;
}
// Prefix dec
Iterator<T2> &operator--() {
_node = _node->_prev;
if (_node)
_node = _node->_prev;
return *this;
}
// Postfix dec
Iterator<T2> operator--(int) {
Iterator<T2> tmp = *this;
_node = _node->_prev;
if (_node)
_node = _node->_prev;
return tmp;
}
T2& operator*() const {
assert(_node);
return static_cast<Node<T2>*>(_node)->_data;
}
T2* operator->() const {