全部博文(237)
分类: C/C++
2009-09-04 17:42:35
Reset()
inline void Reset();
Empties the array.
It frees all memory allocated to the array and resets the internal state so that it is ready to be reused.
This array object can be allowed to go out of scope after a call to this
function. (当退出变量范围的时候,调用这个函数,比如在析构函数中,它只释放数组本身申请的空间并标志成可用,但不释放数组每个成员指针指向的空间,所以调用这个函数会造成内存泄露。 Note: 数组本身相当于指针没置为NULL那种概念)
Note that the function does not delete the objects whose pointers are contained in the array.
ResetAndDestroy()
void ResetAndDestroy();
Empties the array and deletes the referenced objects.
It frees all memory allocated to the array and resets the internal state so that it is ready to be reused. The function also deletes all of the objects whose pointers are contained by the array.
(不但释放数组本身的空间,还将释放数组成员指针指向的堆空间,这样不会造成内存泄露)
This array object can be allowed to go out of scope after a call to this function.
Close()
inline void Close();
Closes the array and frees all memory allocated to it.
The function must be called before this array object goes out of scope.
Note that the function does not delete the objects whose pointers are
contained in the array. (将数组内容清掉,并close掉。类似于置为NULL了)。