Home Segments Index Top Previous Next

778: Mainline

Basically, iterator objects contain member variables that hold pointers to link objects. In the following diagram, for example, an iterator object has a pointer that happens, at the moment shown, to point to the second link in a railroad-car list:

*-------*  A header object 
|       | 
*-------*     Pointer happens    
    |         to point to the 
    |         second link       *-------*  Iterator object   
    |               *---------- |       |   
    |               |           *-------* 
    |               | 
    v               v 
*-------*       *-------*       *-------*  Three link objects 
|       | ----> |       | ----> |   0   |   
|-------|       |-------|       |-------| 
|       |       |       |       |       | 
*-------*       *-------*       *-------*  
    |               |               | 
    v               v               v 
*-------*       *-------*       *-------*  Three railroad_car objects 
|       |       |       |       |       | 
|-------|       |-------|       |-------| 
|       |       |       |       |       | 
|-------|       |-------|       |-------| 
|       |       |       |       |       |