Diff for /parser3/src/include/pa_array.h between versions 1.77 and 1.81

version 1.77, 2009/04/30 04:39:06 version 1.81, 2012/03/16 09:24:08
Line 1 Line 1
 /** @file  /** @file
         Parser: Array & Array_iterator classes decls.          Parser: Array & Array_iterator classes decls.
   
         Copyright (c) 2001-2009 ArtLebedev Group (http://www.artlebedev.com)          Copyright (c) 2001-2012 Art. Lebedev Studio (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 * const IDENT_ARRAY_Y="$Date$";  #define IDENT_PA_ARRAY_H "$Id$"
   
 // includes  // includes
   
Line 95  public: Line 95  public:
         /// append to array          /// append to array
         inline Array& operator+=(T src) {          inline Array& operator+=(T src) {
                 if(is_full())                  if(is_full())
                         expand(fallocated>0?2:3); // 3 is PAF default, confirmed by tests                          expand(fallocated>0? 2+fallocated/32 : 3); // 3 is PAF default, confirmed by tests
   
                 felements[fused++]=src;                  felements[fused++]=src;
   
Line 161  public: Line 161  public:
                 felements[index]=element;                  felements[index]=element;
         }          }
   
           /// remove index-element
           inline void remove(size_t index) {
                   assert(index<count());
                   if (index<--fused)
                           memmove(felements+index+1, felements+index, (fused-index) * sizeof(T));
           }
   
         inline T operator [](size_t index) const { return get(index); }          inline T operator [](size_t index) const { return get(index); }
   
         /// iterate over all elements          /// iterate over all elements
Line 208  protected: Line 215  protected:
                 if(fallocated){                  if(fallocated){
                         size_t new_allocated=fallocated+delta;                          size_t new_allocated=fallocated+delta;
                         felements=(T *)pa_realloc(felements, new_allocated*sizeof(T));                          felements=(T *)pa_realloc(felements, new_allocated*sizeof(T));
                         memset(&felements[fallocated], 0, delta*sizeof(T));  
                         fallocated=new_allocated;                          fallocated=new_allocated;
                 } else {                  } else {
                         fallocated=delta;                          fallocated=delta;

Removed from v.1.77  
changed lines
  Added in v.1.81


E-mail: