CList::AddHead

更新 : 2007 年 11 月

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

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

その他の技術情報

CList のメンバ