CAtlList::SetAt

Call this method to set the value of the element at a given position in the list.

void SetAt( 
   POSITION pos, 
   INARGTYPE element  
);

Parameters

  • pos
    The POSITION value corresponding to the element to change.

  • element
    The new element value.

Remarks

Replaces the existing value with element. In debug builds, an assertion failure will occur if pos is equal to NULL.

Example

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

// Populate the list
myList.AddTail(100);
myList.AddTail(200);

// Use SetAt to change the values stored in the head and 
// tail of the list
myList.SetAt(myList.GetHeadPosition(), myList.GetHead() * 10);
myList.SetAt(myList.GetTailPosition(), myList.GetTail() * 10);

// Confirm the values
ATLASSERT(myList.GetHead() == 1000);
ATLASSERT(myList.GetTail() == 2000);   

Requirements

Header: atlcoll.h

See Also

Reference

CAtlList Class

CAtlList::RemoveAt