Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

CList::InsertAfter

 

Adds an element to this list after the element at the specified position.


      POSITION InsertAfter(
   POSITION position,
   ARG_TYPE newElement 
);

position

A POSITION value returned by a previous GetNext, GetPrev, or Find member function call.

ARG_TYPE

Template parameter specifying the type of the list element.

newElement

The element to be added to this list.

A POSITION value that can be used for iteration or list element retrieval.

Example

// Define myList.
CList<CString,CString&> myList;

// Add three elements to the list.
POSITION pos = myList.AddHead(CString(_T("XYZ")));
pos = myList.InsertAfter(pos, CString(_T("ABC")));
pos = myList.InsertAfter(pos, CString(_T("123")));

// Verify the tail element is what's expected.
ASSERT(CString(_T("123")) == myList.GetTail());   

Requirements

Header: afxtempl.h

Show: