[Scummvm-cvs-logs] CVS: scummvm/common list.h,1.16,1.17
Max Horn
fingolfin at users.sourceforge.net
Sat May 8 12:35:01 CEST 2004
- Previous message: [Scummvm-cvs-logs] CVS: scummvm configure,1.94,1.95
- Next message: [Scummvm-cvs-logs] CVS: scummvm/awe .cvsignore,1.1,NONE awe.cpp,1.1,NONE awe.h,1.1,NONE bank.cpp,1.1,NONE bank.h,1.1,NONE engine.cpp,1.1,NONE engine.h,1.1,NONE file.cpp,1.1,NONE file.h,1.1,NONE intern.h,1.1,NONE logic.cpp,1.1,NONE logic.h,1.1,NONE module.mk,1.1,NONE resource.cpp,1.1,NONE resource.h,1.1,NONE sdlstub.cpp,1.1,NONE serializer.cpp,1.1,NONE serializer.h,1.1,NONE staticres.cpp,1.1,NONE systemstub.h,1.1,NONE util.cpp,1.1,NONE util.h,1.1,NONE video.cpp,1.1,NONE video.h,1.1,NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32519
Modified Files:
list.h
Log Message:
Added default iterator constructor, for convenience
Index: list.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/list.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- list.h 16 Apr 2004 22:04:32 -0000 1.16
+++ list.h 8 May 2004 19:34:06 -0000 1.17
@@ -50,31 +50,37 @@
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 {
- Previous message: [Scummvm-cvs-logs] CVS: scummvm configure,1.94,1.95
- Next message: [Scummvm-cvs-logs] CVS: scummvm/awe .cvsignore,1.1,NONE awe.cpp,1.1,NONE awe.h,1.1,NONE bank.cpp,1.1,NONE bank.h,1.1,NONE engine.cpp,1.1,NONE engine.h,1.1,NONE file.cpp,1.1,NONE file.h,1.1,NONE intern.h,1.1,NONE logic.cpp,1.1,NONE logic.h,1.1,NONE module.mk,1.1,NONE resource.cpp,1.1,NONE resource.h,1.1,NONE sdlstub.cpp,1.1,NONE serializer.cpp,1.1,NONE serializer.h,1.1,NONE staticres.cpp,1.1,NONE systemstub.h,1.1,NONE util.cpp,1.1,NONE util.h,1.1,NONE video.cpp,1.1,NONE video.h,1.1,NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list