Compartir a través de


CList::AddHead

Agrega un nuevo elemento o una lista de elementos al encabezado de esta lista.

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

Parámetros

  • ARG_TYPE
    Parámetro de plantilla que especifica el tipo de elemento de lista (puede ser una referencia).

  • newElement
    Nuevo elemento.

  • pNewList
    un puntero a otra lista de CList . Los elementos de pNewList se agregarán a esta lista.

Valor devuelto

La primera versión devuelve el valor de POSICIÓN de elemento recientemente insertado.

Comentarios

La lista puede estar vacía antes de la operación.

Ejemplo

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

Requisitos

encabezado: afxtempl.h

Vea también

Referencia

CList Class

Gráfico de jerarquías

CList::GetHead

CList::RemoveHead