Diff for /parser3/src/include/pa_array.h between versions 1.60 and 1.67

version 1.60, 2003/11/07 13:59:21 version 1.67, 2005/11/25 12:21:34
Line 1 Line 1
 /** @file  /** @file
         Parser: Array & Array_iterator classes decls.          Parser: Array & Array_iterator classes decls.
   
         Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com)          Copyright (c) 2001-2005 ArtLebedev Group (http://www.artlebedev.com)
         Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)          Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
 */  */
   
 #ifndef PA_ARRAY_H  #ifndef PA_ARRAY_H
 #define PA_ARRAY_H  #define PA_ARRAY_H
   
 static const char* IDENT_ARRAY_Y="$Date$";  static const char * const IDENT_ARRAY_Y="$Date$";
   
 // includes  // includes
   
Line 89  public: Line 89  public:
         /// append to array          /// append to array
         Array& operator += (T src) {          Array& operator += (T src) {
                 if(is_full())                  if(is_full())
                         expand(2);                          expand(+2);
   
                 felements[fused++]=src;                  felements[fused++]=src;
   
Line 139  public: Line 139  public:
   
         /// get index-element          /// get index-element
         T get(size_t index) const {          T get(size_t index) const {
                 assert(index>=0 && index<count());                  assert(index<count());
                 return felements[index];                  return felements[index];
         }          }
   
         /// ref version of get          /// ref version of get
         T& get_ref(size_t index) const {          T& get_ref(size_t index) const {
                 assert(index>=0 && index<count());                  assert(index<count());
                 return felements[index];                  return felements[index];
         }          }
   
         /// put index-element          /// put index-element
         void put(size_t index, T element) {          void put(size_t index, T element) {
                 assert(index>=0 && index<count());                  assert(index<count());
                 felements[index]=element;                  felements[index]=element;
         }          }
   
Line 233  public: Line 233  public:
         }          }
   
 };  };
 /*  
 /** Nonconst array iterator, usage:  
         @code  
         // Array<T> a;  
         for(Array_iterator<T> i(a); i.has_next(); ) {  
                 T& element=i.next();  
                 ...  
         }         
         @endcode  
 * /  
 template<typename T> class Array_modifing_iterator {  
   
         Array<T>& farray;  
         T *fcurrent;  
         T *flast;  
   
 public:  
   
         Array_modifing_iterator(Array<T>& aarray): farray(aarray) {  
                 fcurrent=farray.felements;  
                 flast=farray.felements+farray.count();  
         }  
   
         /// there are still elements  
         bool has_next() {  
                 return fcurrent<flast;  
         }  
   
         /// quickly extracts next Array element  
         T& next() {  
                 return *(fcurrent++);  
         }  
   
 };  
 */  
 #endif  #endif

Removed from v.1.60  
changed lines
  Added in v.1.67


E-mail: