Compartilhar via


CAtlList::RemoveAt

Call this method to remove a single element from the list.

void RemoveAt(
   POSITION pos 
) throw( );

Parameters

  • pos
    The POSITION value of the element to remove.

Remarks

The element referenced by pos is removed, and memory is freed. It is acceptable to use RemoveAt to remove the head or tail of the list.

In debug builds, an assertion failure will occur if the list is not valid or if removing the element causes the list to access memory which isn't part of the list structure.

Example

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

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

// Use RemoveAt to remove elements one by one
myList.RemoveAt(myList.Find(100));
myList.RemoveAt(myList.Find(200));
myList.RemoveAt(myList.Find(300));

// Confirm all have been deleted
ATLASSERT(myList.IsEmpty() == true);   

Requirements

Header: atlcoll.h

See Also

Reference

CAtlList Class

CAtlList::RemoveAll

CAtlList::SetAt

Other Resources

CAtlList Members