New features: Iterators

Every collection defines its Iterator class capable of iterating the members in some predefined order. Every Iterator is defined as a subtype of the particular collection type (e.g., MyPackage_StackOfPnt::Iterator ). The order of iteration is defined by a particular collection type. The methods of Iterator are:

- void Init (const MyCollection&) - initialises the iterator on the collection object;

- Standard_Boolean More () const - makes a query if there is another non-iterated member;

- void Next () - increments the iterator;

- const ItemType& Value () const - returns the current member;

- ItemType& ChangeValue () const - returns the mutable current member

Example:

typedef Ncollection_Sequence<gp_Pnt>

MyPackage_SequenceOfPnt

void Perform (const MyPackage_SequenceOfPnt& theSequence)

{

MyPackage_SequenceOfPnt::Iterator anIter (theSequence);

for (; anIter.More(); anIter.Next()) {

const gp_Pnt aPnt& = anIter.Value();

....

}

}

This feature is present only for some classes in TCollection (Stack, List, Set, Map, DataMap, DoubleMap). In NCollection it is generalised.