Partager via


CTypedPtrList::GetHead

Gets the pointer that represents the head element of this list.

TYPE& GetHead( ); 
TYPE GetHead( ) const;

Parameters

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

Return Value

If the list is accessed through a pointer to a const CTypedPtrList, then GetHead returns a pointer of the type specified by the template parameter TYPE. This allows the function to be used only on the right side of an assignment statement and thus protects the list from modification.

If the list is accessed directly or through a pointer to a CTypedPtrList, then GetHead returns a reference to a pointer of the type specified by the template parameter TYPE. This allows the function to be used on either side of an assignment statement and thus allows the list entries to be modified.

Remarks

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.

Requirements

Header: afxtempl.h

See Also

Reference

CTypedPtrList Class

Hierarchy Chart

CObList::IsEmpty

CTypedPtrList::GetTail

CTypedPtrList::GetNext

CTypedPtrList::GetPrev