--- parser3/src/include/pa_array.h 2009/04/29 03:26:38 1.76 +++ parser3/src/include/pa_array.h 2010/11/05 21:56:49 1.80 @@ -8,7 +8,7 @@ #ifndef PA_ARRAY_H #define PA_ARRAY_H -static const char * const IDENT_ARRAY_Y="$Date: 2009/04/29 03:26:38 $"; +static const char * const IDENT_ARRAY_Y="$Date: 2010/11/05 21:56:49 $"; // includes @@ -80,13 +80,13 @@ public: fallocated(initial), fused(0) { - felements=fallocated?static_cast(malloc(fallocated*sizeof(T))):0; + felements=fallocated?(T *)pa_malloc(fallocated*sizeof(T)):0; } #ifdef USE_DESTRUCTORS inline ~Array(){ if(felements) - free(felements); + pa_free(felements); } #endif @@ -95,7 +95,7 @@ public: /// append to array inline Array& operator+=(T src) { 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; @@ -161,6 +161,13 @@ public: felements[index]=element; } + /// remove index-element + inline void remove(size_t index) { + assert(index(malloc(fallocated*sizeof(T))); + felements=(T *)pa_malloc(fallocated*sizeof(T)); } }