CList::AddHead

Aggiungere un nuovo elemento o un elenco di elementi all'intestazione di questo elenco.

POSITION AddHead(
   ARG_TYPE newElement 
);
void AddHead(
   CList* pNewList 
);

Parametri

  • ARG_TYPE
    Parametro di modello che specifica il tipo di elemento di elenco (può essere un riferimento).

  • newElement
    Nuovo elemento.

  • pNewList
    Un puntatore a un altro elenco CList.Gli elementi in pNewList verranno aggiunti all'elenco.

Valore restituito

La prima versione restituisce il valore della posizione dell'elemento appena inserito.

Note

L'elenco può essere vuoto prima dell'operazione.

Esempio

// Declarations of the variables used in the example
CList<CString,CString&> myList;
CList<CString,CString&> myList2;

// There are two versions of CList::AddHead: one adds a single
// element to the front of the list, the second adds another list
// to the front. 

// This adds the string "ABC" to the front of myList.
// myList is a list of CStrings (ie defined as CList<CString,CString&>).
myList.AddHead(CString(_T("ABC")));

// This adds the elements of myList2 to the front of myList.
myList.AddHead(&myList2);      

Requisiti

Header: afxtempl.h

Vedere anche

Riferimenti

Classe di CList

Grafico della gerarchia

CList::GetHead

CList::RemoveHead