Share via


CAtlList::MoveToHead

Call this method to move the specified element to the head of the list.

void MoveToHead( 
   POSITION pos  
) throw( );

Parameters

  • pos
    The POSITION value of the element to move.

Remarks

The specified element is moved from its current position to the head of the list. In debug builds, an assertion failure will occur if pos is equal to NULL.

Example

// Define the integer list
CAtlList<int> myList;

// Populate the list
myList.AddTail(1);
myList.AddTail(2);
myList.AddTail(3);
myList.AddTail(4);

// Move the tail element to the head
myList.MoveToHead(myList.GetTailPosition());

// Confirm the head is as expected
ATLASSERT(myList.GetHead() == 4);

// Move the head element to the tail
myList.MoveToTail(myList.GetHeadPosition());

// Confirm the tail is as expected
ATLASSERT(myList.GetTail() == 4);   

Requirements

Header: atlcoll.h

See Also

Reference

CAtlList Class

CAtlList::MoveToTail

CAtlList::SwapElements