Delen via


CList::RemoveTail

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

TYPE RemoveTail( );

Parameters

  • TYPE
    Template parameter specifying the type of elements in the list.

Return Value

The element that was at the tail of the list.

Remarks

You must ensure that the list is not empty before calling RemoveTail. 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.

Example

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

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

// Remove the tail element and verify the list. 
// NOTE: once the tail is removed, the number of 
// elements in the list will be one.
CString strTail = myList.RemoveTail();
ASSERT((CString(_T("123")) == strTail) && (myList.GetCount() == 1) && 
   (CString(_T("ABC")) == myList.GetTail()));      

Requirements

Header: afxtempl.h

See Also

Reference

CList Class

Hierarchy Chart

CList::GetTail

CList::AddTail