Поделиться через


CObList::RemoveTail

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

CObject* RemoveTail( );

Возвращаемое значение

A pointer to the object that was at the tail of the list.

Заметки

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.

The following table shows other member functions that are similar to CObList::RemoveTail.

Class

Member Function

CPtrList

void* RemoveTail( );

CStringList

CString RemoveTail( );

Пример

See CObList::CObList for a listing of the CAge class.

CObList list;
CAge* pa1;
CAge* pa2;

list.AddHead(pa1 = new CAge(21));
list.AddHead(pa2 = new CAge(40)); // List now contains (40, 21).
ASSERT(*(CAge*) list.RemoveTail() == CAge(21));  // Old tail
ASSERT(*(CAge*) list.GetTail() == CAge(40));  // New tail
delete pa1;
delete pa2; // Clean up memory.      

Требования

Header: afxcoll.h

См. также

Основные понятия

CObList Class

CObList Members

Hierarchy Chart

CObList::GetTail

CObList::AddTail