CList::AddHead

添加一个新元素或列表元素到此开头的列表。

POSITION AddHead(
   ARG_TYPE newElement 
);
void AddHead(
   CList* pNewList 
);

参数

  • ARG_TYPE
    指定列表元素的类型模板参数(可以是引用)。

  • newElement
    新元素。

  • pNewList
    到另一 CList 的指针列表。 在 pNewList 的组件将添加到此列表。

返回值

第一个版本返回新插入的元素的 POSITION 值。

备注

该列表可为null在操作之前。

示例

// Declarations of the variables used in the example
CList<CString,CString&> myList;
CList<CString,CString&> myList2;

// There are two versions of CList::AddHead: one adds a single
// element to the front of the list, the second adds another list
// to the front. 

// This adds the string "ABC" to the front of myList.
// myList is a list of CStrings (ie defined as CList<CString,CString&>).
myList.AddHead(CString(_T("ABC")));

// This adds the elements of myList2 to the front of myList.
myList.AddHead(&myList2);      

要求

Header: afxtempl.h

请参见

参考

CList选件类

层次结构图

CList::GetHead

CList::RemoveHead