CObList::RemoveAll

Syntax

void RemoveAll();

Remarks

Removes all the elements from this list and frees the associated CObList memory. No error is generated if the list is already empty.

When you remove elements from a CObList, you remove the object pointers from the list. It is your responsibility to delete the objects themselves.

Example

CObList list;

CAge* pa1;

CAge* pa2;

ASSERT( list.IsEmpty()); // Yes it is

list.AddHead( pa1 = new CAge( 21 ) );

list.AddHead( pa2 = new CAge( 40 ) ); // List now contains (40, 21)

ASSERT( !list.IsEmpty()); // No it isn't

list.RemoveAll(); // CAge's aren't destroyed

ASSERT( list.IsEmpty()); // Yes it is

delete pa1; // Now delete the CAge objects

delete pa2;