CObArray::RemoveAll
Removes all the pointers from this array but does not actually delete the CObject objects.
void RemoveAll( );
Заметки
If the array is already empty, the function still works.
The RemoveAll function frees all memory used for pointer storage.
The following table shows other member functions that are similar to CObArray::RemoveAll.
Class |
Member Function |
---|---|
void RemoveAll( ); |
|
void RemoveAll( ); |
|
void RemoveAll( ); |
|
void RemoveAll( ); |
|
void RemoveAll( ); |
|
void RemoveAll( ); |
Пример
See CObList::CObList for a listing of the CAge class used in all collection examples.
CObArray arr;
CAge* pa1;
CAge* pa2;
arr.Add(pa1 = new CAge(21)); // Element 0
arr.Add(pa2 = new CAge(40)); // Element 1
ASSERT(arr.GetSize() == 2);
arr.RemoveAll(); // Pointers removed but objects not deleted.
ASSERT(arr.GetSize() == 0);
delete pa1;
delete pa2; // Cleans up memory.
Требования
Header: afxcoll.h