Diff for /parser3/src/include/pa_array.h between versions 1.91 and 1.92

version 1.91, 2024/09/11 21:07:36 version 1.92, 2024/09/14 22:58:50
Line 76  public: Line 76  public:
   
                         return true;                          return true;
                 }                  }
   
                   
         };          };
   
         typedef T element_type;          typedef T element_type;
Line 89  public: Line 87  public:
                 felements=fallocated?(T *)pa_malloc(fallocated*sizeof(T)):0;                  felements=fallocated?(T *)pa_malloc(fallocated*sizeof(T)):0;
         }          }
   
 #ifdef USE_DESTRUCTORS   #ifdef USE_DESTRUCTORS
         inline ~Array(){          inline ~Array(){
                 if(felements)                  if(felements)
                         pa_free(felements);                          pa_free(felements);
Line 98  public: Line 96  public:
   
         /// how many items are in Array          /// how many items are in Array
         inline size_t count() const { return fused; }          inline size_t count() const { return fused; }
   
         /// append to array          /// append to array
         inline Array& operator+=(T src) {          inline Array& operator+=(T src) {
                 if(is_full())                  if(is_full())
Line 217  public: Line 216  public:
                 return felements + index;                  return felements + index;
         }          }
   
         void fit(size_t index, T element){  
                 if(index >= fallocated){  
                         size_t new_allocated=fallocated>0 ? fallocated : 3;  
                         while(new_allocated <= index){  
                                 new_allocated+=2 + new_allocated/32;  
                         }  
                         expand(new_allocated - fallocated);  
                 }  
                 felements[index]=element;  
                 if(index >= fused){  
                         fused=index+1;  
                 }  
         }  
   
 protected:  protected:
   
         bool is_full() {          bool is_full() {
Line 254  private: //disabled Line 239  private: //disabled
         Array& operator = (const Array&) { return *this; }          Array& operator = (const Array&) { return *this; }
 };  };
   
   
 /// Commonly used, templated to work with any integer type  /// Commonly used, templated to work with any integer type
   
 template<typename T> char* pa_itoa(T n, T base=10){  template<typename T> char* pa_itoa(T n, T base=10){
Line 310  public: Line 296  public:
   
         Array_iterator(const Array<T>& aarray): farray(aarray) {          Array_iterator(const Array<T>& aarray): farray(aarray) {
                 fcurrent=farray.felements;                  fcurrent=farray.felements;
                 flast=farray.felements + farray.count();                  flast=farray.felements + farray.fused;
         }          }
   
         /// there are still elements          /// there are still elements
Line 347  template<typename T> class Array_reverse Line 333  template<typename T> class Array_reverse
 public:  public:
   
         Array_reverse_iterator(const Array<T>& aarray): farray(aarray) {          Array_reverse_iterator(const Array<T>& aarray): farray(aarray) {
                 fcurrent=farray.felements+farray.count();                  fcurrent=farray.felements + farray.fused;
         }          }
   
         /// there are still elements          /// there are still elements

Removed from v.1.91  
changed lines
  Added in v.1.92


E-mail: