CList<int, int&>list;
for (int i = 0; i < 10; i++)
{
list.AddHead(i);
}
DWORD dwLength = list.GetCount();
for (i = 0; i < dwLength;)
{
POSITION p = list.FindIndex(i);
int n = list.GetAt(p);
if (n == 4)
{
list.RemoveAt(p);
dwLength–;
}
else
{
cout << n << endl;
i++;
}
}