CObArray::RemoveAll

void RemoveAll( );

Remarks

Removes all the pointers from this array but does not actually delete the CObject objects. 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
CByteArray void RemoveAll( );
CDWordArray void RemoveAll( );
CPtrArray void RemoveAll( );
CStringArray void RemoveAll( );
CUIntArray void RemoveAll( );
CWordArray void RemoveAll( );

Example

See CObList::CObList for a listing of the CAge class used in all collection examples.

// example for CObArray::RemoveAll

CObArray array;
CAge* pa1;
CAge* pa2;

array.Add( pa1 = new CAge( 21 ) ); // Element 0
array.Add( pa2 = new CAge( 40 ) ); // Element 1
ASSERT( array.GetSize() == 2 );
array.RemoveAll(); // Pointers removed but objects not deleted.
ASSERT( array.GetSize() == 0 );
delete pa1;
delete pa2;  // Cleans up memory.

CObArray OverviewClass MembersHierarchy Chart