CObList::RemoveAll

从此移除所有元素列表并释放关联的 CObList 内存。

void RemoveAll( );

备注

如果列表已经为空,则不生成。

当从 CObList中移除元素,然后从列表中移除对象指针。 您有责任删除对象。

下表显示类似于 CObList::RemoveAll的其他成员函数。

成员函数

CPtrList

无效RemoveAll( );

CStringList

无效RemoveAll( );

示例

用于列表 CAge 选件类参见 CObList::CObList

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(); // CAges aren't destroyed.
ASSERT(list.IsEmpty()); // Yes it is.
delete pa1;     // Now delete the CAge objects.
delete pa2;      

要求

Header: afxcoll.h

请参见

参考

CObList选件类

层次结构图