2010-01-21

Java-style Iterator vs. STL-style Iterator

The best comparison of Java-style and STL-style iterator is given in this article: http://doc.trolltech.com/4.5/containers.html#the-foreach-keyword. Some citations for summary:


  • Java-style iterator. "..Unlike STL-style iterators (covered below), Java-style iterators point between items rather than directly at items. For this reason, they are either pointing to the very beginning of the container (before the first item), at the very end of the container (after the last item), or between two items..."

  • STL-style iterator: "...The API of the STL iterators is modelled on pointers in an array. For example, the ++ operator advances the iterator to the next item, and the * operator returns the item that the iterator points to..."

No comments:

Post a Comment