CList::RemoveHead

从列表的开头移除元素并返回指向它。

TYPE RemoveHead( );

参数

  • 类型
    指定元素的类型模板参数列表。

返回值

上一个元素列表的开头。

备注

您必须确保列表在调用 RemoveHead之前不为null。 如果列表为空,则选件Microsoft基础类库的调试版本断言。 使用 IsEmpty 验证列表包含元素。

示例

// Define myList.
CList<CString,CString&> myList;

// Add two elements to the list.
myList.AddHead(CString(_T("ABC")));
myList.AddHead(CString(_T("123")));

// Remove the head element and verify the list.
// NOTE: once the head is removed, the number of
// elements in the list will be one.
CString strHead = myList.RemoveHead();
ASSERT((CString(_T("123")) == strHead) && (myList.GetCount() == 1) && 
   (CString(_T("ABC")) == myList.GetHead()));      

要求

Header: afxtempl.h

请参见

参考

CList选件类

层次结构图

CList::GetHead

CList::AddHead