= Iterator = [[TracNav(TracNav/TOC_Development)]] The Iterator allows you to iteratate through any [wiki:ObjectList] you like. It's possible to iterate through all objects of class '''B''' with an Iterator of class '''A''', under condition that '''B''' is a child of '''A'''. Iterator does a dynamic_cast to the requested class. Because this is not really performant, you should always use [wiki:ObjectListIterator] instead in case that '''A''' == '''B'''. '''Important''': Always use [wiki:ObjectListIterator] if you know at compiletime through which class you want to iterate. Iterator is made to iterate through a list of objects which gets determined at runtime. For this reason you can create an Iterator not only by calling !ObjectList::begin() but also through anyidentifier->getObjects()->begin(). Of course end(), rbegin() and rend() work too. == Illustration == [[Image(Iterator.png)]] == Example == {{{ Identifier* identifier = someFunctionReturningAnIdentifier(); for (Iterator it = identifier->getObjects()->begin(); it != identifier->getObjects()->end(); ++it) { it->callSomeFunction(...); BaseObject* storeTheObject = (*it); } }}} {{{ for (Iterator it = ObjectList::begin(); it != ObjectList::end(); ++it) { it->callSomeFunction(...); BaseObject* storeTheObject = (*it); } // Note: // In this case you should better use ObjectListIterator // to avoid a dynamic_cast }}}