Changes between Version 4 and Version 5 of code/doc/ObjectListIterator
- Timestamp:
- Sep 28, 2008, 7:33:35 PM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
code/doc/ObjectListIterator
v4 v5 8 8 '''Important''': Always use !ObjectListIterator instead of Iterator if you know which class you want to iterate through. 9 9 10 == Notation == 11 There are two equivalent notations: 12 {{{ 13 ObjectListIterator<T> 14 }}} 15 and 16 {{{ 17 ObjectList<T>::iterator 18 }}} 19 Use whatever you like. '''Important''': The second notation needs !ObjectList.h, while the first notation works already with a forward declaration. So if you need the iterator in a header-file, you should prefer the first notation. 20 10 21 == Examples == 11 22 {{{ 12 for (ObjectList Iterator<myClass>it = ObjectList<myClass>::begin();23 for (ObjectList<myClass>::iterator it = ObjectList<myClass>::begin(); 13 24 it != ObjectList<myClass>::end(); ++it) 14 25 { … … 33 44 34 45 int count = 0; 35 for (ObjectList Iterator<BaseObject>it = ObjectList<BaseObject>::begin();36 it != ObjectList<BaseObject>::end(); ++it)46 for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); 47 it != ObjectList<BaseObject>::end(); ++it) 37 48 { 38 49 count++; … … 41 52 42 53 count = 0; 43 for (ObjectList Iterator<A1>it = ObjectList<A1>::begin();44 it != ObjectList<A1>::end(); ++it)54 for (ObjectList<A1>::iterator it = ObjectList<A1>::begin(); 55 it != ObjectList<A1>::end(); ++it) 45 56 { 46 57 count++; … … 49 60 50 61 count = 0; 51 for (ObjectList Iterator<A3B1>it = ObjectList<A3B1>::begin();52 it != ObjectList<A3B1>::end(); ++it)62 for (ObjectList<A3B1>::iterator it = ObjectList<A3B1>::begin(); 63 it != ObjectList<A3B1>::end(); ++it) 53 64 { 54 65 count++;