次の方法で共有


CList::GetSize

リストの要素数を返します。

INT_PTR GetSize( ) const;

戻り値

リストの項目数。

解説

リストの要素の数を取得するときにこのメソッドを呼び出します。このメソッドを呼び出すと、CList::GetCount のメソッドと同じ結果を生成します。

使用例

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

// Add two elements to the list.
myList.AddHead(CString(_T("ABC")));
myList.AddHead(CString(_T("123")));

// Remove the head element and verify the list.
// NOTE: once the head is removed, the number of
// elements in the list will be one.
CString strHead = myList.RemoveHead();
ASSERT((CString(_T("123")) == strHead) && (myList.GetSize() == 1) && 
   (CString(_T("ABC")) == myList.GetHead()));      

必要条件

ヘッダー: afxtempl.h

参照

関連項目

CList クラス

階層図

CList::GetCount