功能:
It provides methodsfor insertion and retrieval of these pointers values, and will automatically resize itself to hold new data.
变量:
void** Array; // pointer to data
int Size; // allocated size of data
int MaxId; // maximum index inserted thus far
int Extend; // grow array by this point
函数:
//new分配出sz大小的空间,Extend=ext,MaxId=-1,size=sz;
int Allocate(const int sz, const int ext=1000);
//delete释放空间,size=0,MaxId=-1
void Initialize();
//MaxId=-1,其他不变
void Reset();
//Size=sz,数据可能被截取或补空
void** Resize(const int sz);
//size=MaxId+1;
void Squeeze();
//返回(Array+id)
void** GetPtr(const int id);
//返回(Array+id)的同时,要保证其后有number个空间分配,通过(Resize,MaxId=size+number)扩展
void** WritePtr(const int id, const int number);