TYPE& GetHead( );
TYPE GetHead( ) const;
Return Value
If the list is const, GetHead returns a copy of the element at the head of the list. This allows the function to be used only on the right side of an assignment statement and protects the list from modification.
If the list is not const, GetHead returns a reference to an element of the list. This allows the function to be used on either side of an assignment statement and thus allows the list entries to be modified.
Parameters
TYPE
Template parameter specifying the type of object in the list.
Remarks
Gets the head element (or a reference to the head element) of this list.
You must ensure that the list is not empty before calling GetHead. 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 an element to the front of the list.
myList.AddHead(CString("ABC"));
// Verify the element was added to the front of the list.
ASSERT(CString("ABC") == myList.GetHead());
CList Overview | Class Members | Hierarchy Chart
See Also CList::GetTail, CList::GetTailPosition, CList::AddHead, CList::RemoveHead