Share via


CAtlList::GetHead

 

Call this method to return the element at the head of the list.

Syntax

      E& GetHead( ) throw( ); 
const E& GetHead( ) const throw( );

Return Value

Returns a reference to, or a copy of, the element at the head of the list.

Remarks

If the list is const, GetHead returns a copy of the element at the head of the list. This allows the method 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 the element at the head of the list. This allows the method to be used on either side of an assignment statement and thus allows the list entries to be modified.

In debug builds, an assertion failure will occur if the head of the list points to NULL.

Example

See the example for CAtlList::AddHead.

Requirements

Header: atlcoll.h

See Also

CAtlList Class
CAtlList::GetHeadPosition
CAtlList::GetTail