CAtlList::InsertAfter

Call this method to insert a new element into the list after the specified position.

POSITION InsertAfter( 
   POSITION pos, 
   INARGTYPE element  
);

Parameters

  • pos
    The POSITION value after which the new element will be inserted.

  • element
    The element to be inserted.

Return Value

Returns the POSITION value of the new element.

Remarks

In debug builds, an assertion failure will occur if the list isn't valid, if the insert fails, or if an attempt is made to insert the element after the tail.

Example

// Define the integer list
CAtlList<int> myList;

// Populate the list
POSITION myPos = myList.AddHead(1);
myPos = myList.InsertAfter(myPos, 2);
myPos = myList.InsertAfter(myPos, 3);

// Confirm the tail value is as expected
ATLASSERT(myList.GetTail() == 3);   

Requirements

Header: atlcoll.h

See Also

Reference

CAtlList Class

CAtlList::InsertBefore