다음을 통해 공유


CAtlList::AddHead

목록의 헤드에 요소를 추가 하려면이 메서드를 호출 합니다.

POSITION AddHead( ); 
POSITION AddHead(
   INARGTYPE element 
);

매개 변수

  • element
    새 요소입니다.

반환 값

새로 추가 되는 요소의 위치를 반환합니다.

설명

첫 번째 버전을 사용 하는 경우 보다 복사 생성자는 기본 생성자를 사용 하 여 빈 요소가 만들어집니다.

예제

// Declare a list of integers
CAtlList<int> myList;

// Add some elements, each to the head of the list.
// As each new element is added, the previous head is
// pushed down the list.
myList.AddHead(42);
myList.AddHead(49);

// Confirm the value currently at the head of the list
ATLASSERT(myList.GetHead() == 49);

// Confirm the value currently at the tail of the list
ATLASSERT(myList.GetTail() == 42);   

요구 사항

헤더: atlcoll.h

참고 항목

참조

CAtlList 클래스

CAtlList::AddHeadList

CAtlList::AddTail