Changes to class Iterator

Iterator::shallowCopy() now produces a shallow copy with a pointer to the same collection bound to the original instead of to a shallow copy of the collection bound to the original, as in prior releases. Iterator::deepCopy() works as before: it produces a deep copy with a pointer to a deep copy of the collection bound to the original.

The member variable Object* state has been added, which collection classes can use to associate additional state information with an Iterator. For example, a collection class implemented as a tree structure can use state to point to a Stack used to maintain the state of a traversal of the tree. The destructor for class Iterator calls a new virtual function, doFinish(), which a class that uses state can reimplement to delete the state object when the Iterator is destroyed.

The storeOn() format has changed as a result of these modifications.

The function Object* Iterator::operator()() has been added to return a pointer to the current object, or 0 if there is none.