In this example, the programmer wishes to loop through all the banks in a record, one at a time. The initialization clause assures that the iterator points to the first bank in the record, whatever the bank's name is. The end test clause checks that the iterator is still valid (not at end of record). If there are no banks in the record, this loop will not execute at all, as desired. Finally the iteration clause causes the iterator to point to the next bank, whatever the bank's name is. The banks are visited in the same order in which they happen to be arranged in the record. There is no guarantee that the bank names or numbers, for instance, will be in increasing or decreasing order.
// for loop initialization................ end test............ iteration
// -----------------------------------------------------------------------
for (TRY_Record_Iter_Any my_iter(p_record) ; my_iter.is_valid() ; ++my_iter)
{
// my_iter points to each bank in record sequentially
}