Partager via


CAtlList::AddTail

Call this method to add an element to the tail of this list.

POSITION AddTail( ); 
POSITION AddTail( 
   INARGTYPE element  
);

Parameters

  • element
    The element to add.

Return Value

Returns the POSITION of the newly added element.

Remarks

If the first version is used, an empty element is created using its default constructor, rather than its copy constructor. The element is added to the end of the list, and so it now becomes the tail. This method can be used with an empty list.

Example

// Define the list
CAtlList<int> myList;

// Add elements to the tail
myList.AddTail(1);
myList.AddTail(2);
myList.AddTail(3);

// Confirm the current head of the list
ATLASSERT(myList.GetHead() == 1);

// Confirm the current tail of the list
ATLASSERT(myList.GetTail() == 3);   

Requirements

Header: atlcoll.h

See Also

Reference

CAtlList Class

CAtlList::AddTailList

CAtlList::AddHead