Export (0) Print
Expand All

CList::RemoveHead

Removes the element from the head of the list and returns a pointer to it.

TYPE RemoveHead( );

TYPE

Template parameter specifying the type of elements in the list.

The element previously at the head of the list.

You must ensure that the list is not empty before calling RemoveHead. If the list is empty, then the Debug version of the Microsoft Foundation Class Library asserts. Use IsEmpty to verify that the list contains elements.

// 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.GetCount() == 1) && 
   (CString(_T("ABC")) == myList.GetHead()));      

Header: afxtempl.h

Show:
© 2014 Microsoft