      ,       
  .     DIRECT.CPP,   16.3   
  ,        TIQueueAsDoubleList. 

     16.3.   ITERATE.CPP ( ) 

    1:   include <iostream.h> 
    2:   include <cstring.h> 
    3:   include <classlib\queues.h> 
    4: 
    5: //      
    6 TIQueueAsDoubleList<string> iQueue;	
    7: 
    8: int main()	
    9: {	
    10:	//                                      
    11:	iQueue.Put(new string("Line up")); 
    12:	iQueue.Put(new string("for the"));                                    
    13:	iQueue.Put(new string("Magical"));         
    14:	iQueue.Put(new string("Mystery"));   
    15:	iQueue.Put(new string("Tour"  ));                                      
    16:	
    17:	//      iQueue                    
    18:	TIQueueAsDoubleListIterator<string> iterator(iOueue); 
    19: 
    20:	//       
    21:	cout  "\nWalk the queue using an iterator:"  endl; 
    22:	cout  ""  endl; 
    ! 23:	while (iterator != 0) { 
    24:	   cout  iterator.Current()  endl; 
    25:	   iterater++; 
    26:	} 
    27:	 
    28:	//                 
    29:	cout  "\nExtract queue objects:"  endl;               
    30:	cout  ""  endl; 
    31:	while ( !iQueue.IsEmpty() ) { 
    32:	   string *p = iQueue.Get();                                     
    33:	   cout  *p  endl; 
    34:	   delete p; 
    35:	}                                                                      
    36:	
    37:	return 0; 
    38:	}

              
iQueue.     (    TI),   
    : 

    TIQueueAsOoubleList<string> iQueue;	

      ,       
  new      .  
       , 
  new, - Put()   . 
 PutO      ,    AddO  : 

    iQueue.Put(new string("Hagical")); 
    iQueue.Put(new string("Mystery")); 

         ,    
   TIQueueAsDoubleList.     
    Iterator: 

    TIQueueAsDoubleListIterator<string> iterator(iQueue); 

      ,       ,  
           
typedef, :	

    typedef TIQueueAsDoubleListIterator<string> Tlterator; 

     typedef ,   TIterator    
"" .      
 (    ): 

    TIterator iterator(iQueue); 

      ,    (   iterator) 
 TIQueueAsDoubleListIterator<string>.   iQueue  
     .    
      iQueue. 


    432	 IV.   
