Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Initial Version and Version 1 of code/doc/ObjectListIterator


Ignore:
Timestamp:
Sep 27, 2008, 4:01:07 AM (16 years ago)
Author:
landauf
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • code/doc/ObjectListIterator

    v1 v1  
     1= !ObjectListIterator =
     2[[TracNav(TracNav/TOC_Development)]]
     3
     4The !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 [wiki:ObjectList ObjectLists] functions begin, end, rbegin or rend, where the !ObjectList has to be of the same T as the !ObjectListIterator.
     5
     6Another way to iterate through object-lists is by using [wiki: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:
     7
     8'''Important''': Always use !ObjectListIterator instead of Iterator if you know which class you want to iterate through.
     9
     10== Example ==
     11{{{
     12for (ObjectListIterator<myClass> it = ObjectList<myClass>::begin();
     13                                 it != ObjectList<myClass>::end(); ++it)
     14{
     15    it->someFunction(...);
     16    myClass* myObject = *it;
     17}
     18}}}