Udostępnij za pośrednictwem


CAtlList::AddHead

Wywołanie tej metody, aby dodać element do głowy listy.

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

Parametry

  • element
    Nowy element.

Wartość zwracana

Zwraca pozycję nowo dodany element.

Uwagi

Jeśli pierwsza wersja pusty element jest tworzony za pomocą jego domyślny konstruktor zamiast jego kopii konstruktora.

Przykład

// 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);   

Wymagania

Nagłówek: atlcoll.h

Zobacz też

Informacje

Klasa CAtlList

CAtlList::AddHeadList

CAtlList::AddTail