Hello,
so, I have a list of objects taht i made (they're calle Cgate objects)
they're in a list. I made a routine that will search through the list and find what it wants to delete..
so what i have so far is.. i can search through the list, and remove the object from the list..
but i'm trying to delete the actual object..when i throw in some code to delete the object, the list search and removal code doens't work anymore.. here's the code.. what do you guys think?
see where i have the // delete CgatePHP Code:
case REMOVE:
while (pos != NULL)
{
CGate* pGate = gateList.GetNext(pos);
if(pGate->GateID == WhichGate)
{
pGate = gateList.GetPrev(pos);
gateList.RemoveAt(pos);
//delete pGate;
CurrentOperation = NOTHING; // to get out of "delete mode"
break; // when found and deleted stop going through list
}
else if(pos == gateList.GetTailPosition())
{
pGate = gateList.GetNext(pos);
pGate = gateList.RemoveTail();
break;
}
}
break;
i thought i could delete the object like that, but it seems to screw my list up.
it seems to screw with the location the object was in..