CAtlList::MoveToHead
呼叫這個方法會將指定的項目移至清單的開頭。
void MoveToHead(
POSITION pos
) throw( );
參數
- pos
移動之項目的位置值。
備註
指定項目會從目前位置移至清單的開頭。如果 pos 具有 null 值,等於在偵錯組建中,判斷提示失敗時會發生。
範例
// 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);
需求
Header: atlcoll.h