Version 1 (modified by landauf, 16 years ago) (diff) |
---|
ObjectListIterator
TracNav(TracNav/TOC_Development)?
The ObjectListIterator of a given class T can iterate exactly through all objects of class T and inheritors. The only way to create such an iterator is by calling one of ObjectLists functions begin, end, rbegin or rend, where the ObjectList has to be of the same T as the ObjectListIterator.
Another way to iterate through object-lists is by using Iterator. ObjectListIterator however is much more performant as it knows about the right class an therefore needs no dynamic-cast. That's why you should always remember:
Important: Always use ObjectListIterator instead of Iterator if you know which class you want to iterate through.
Example
for (ObjectListIterator<myClass> it = ObjectList<myClass>::begin(); it != ObjectList<myClass>::end(); ++it) { it->someFunction(...); myClass* myObject = *it; }