CList::AddTail

更新 : 2007 年 11 月

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

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

パラメータ

  • ARG_TYPE
    リスト要素の型を指定するテンプレート パラメータ (参照でもかまいません)。

  • newElement
    リストに追加する要素。

  • pNewList
    他の CList リストへのポインタ。pNewList 内の要素がこのリストに追加されます。

戻り値

最初の形式は、新しく挿入した要素の POSITION 値を返します。

解説

操作する前のリストの状態は空でもかまいません。

使用例

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

// Add elements to the end of myList and myList2.
myList.AddTail(CString(_T("A")));
myList.AddTail(CString(_T("B")));
myList2.AddTail(CString(_T("C")));
myList2.AddTail(CString(_T("D")));

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

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

// This adds the elements of myList2 to the end of myList.
myList.AddTail(&myList2);

必要条件

ヘッダー : afxtempl.h

参照

参照

CList クラス

階層図

CObList::GetTail

CObList::RemoveTail

その他の技術情報

CList のメンバ