[ fromfile: iterators.xml id: iterators ]
Any time you have a container of things, sooner or later, you are probably going to loop through the container and do something with each thing. An iterator is an object that provides indirect access to each element in a container. It is specifically designed to be used in a loop.
Qt 4 supports the following styles of iteration:
Qt 4 style foreach loops, similar to Perl and Python
Java 1.2 style Iterator, which always point inbetween elements
Standard Library style ContainerType::iterator
Hand-made while or for loops that use getters of the container
QDirIterator, for iterating through entries in a directory structure
The next section demonstrates the various styles of iteration available in C++ with Qt 4.
| Generated: $Date: 2009-09-08 12:15:32 -0400 (Tue, 08 Sep 2009) $ | © 2009 Alan Ezust and Paul Ezust. |