template <class T> Array<T>::Array(size_t Size) { Buffer=(T *)malloc(sizeof(T)*Size); if (Buffer==NULL && Size!=0) ErrHandler.MemoryError(); AllocSize=BufSize=Size; }
template <class T> void Array<T>::Add(size_t Items) { BufSize+=Items; if (BufSize>AllocSize) { size_t Suggested=AllocSize+AllocSize/4+32; size_t NewSize=Max(BufSize,Suggested); Buffer=(T *)realloc(Buffer,NewSize*sizeof(T)); if (Buffer==NULL) ErrHandler.MemoryError(); AllocSize=NewSize; } }