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:

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.