共用方式為


CAtlList::AddHead

呼叫這個方法將項目加入至清單的開頭。

POSITION AddHead( ); 
POSITION AddHead(
   INARGTYPE element 
);

參數

  • element
    新項目。

傳回值

傳回這個新加入之項目的位置。

備註

如果使用第一個版本,則會使用其預設建構函式,建立空項目,而不是它的複製建構函式。

範例

// Declare a list of integers
CAtlList<int> myList;

// Add some elements, each to the head of the list.
// As each new element is added, the previous head is
// pushed down the list.
myList.AddHead(42);
myList.AddHead(49);

// Confirm the value currently at the head of the list
ATLASSERT(myList.GetHead() == 49);

// Confirm the value currently at the tail of the list
ATLASSERT(myList.GetTail() == 42);   

需求

Header: atlcoll.h

請參閱

參考

CAtlList 類別

CAtlList::AddHeadList

CAtlList::AddTail