次の方法で共有


CList::AddHead

この一覧の先頭に新しい要素または要素のリストを追加します。

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

パラメーター

  • ARG_TYPE
    リストの要素の型を指定するテンプレート パラメーター (参照になります)。

  • newElement
    新しい要素。

  • pNewList
    CList の別のリストへのポインター。pNewList の要素は、この一覧に追加されます。

戻り値

最初のバージョンが新しく挿入される要素の POSITION の値を返します。

解説

リストは、演算の前に空の場合もあります。

使用例

// 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);      

必要条件

ヘッダー: afxtempl.h

参照

関連項目

CList クラス

階層図

CList::GetHead

CList::RemoveHead