F
Flwz
There's something I don't quite understand, sorry if that sound stupid
or whatever ; )
why is :
for( it = Flare::flareList.begin() ; it != Flare::flareList.end(); it++)
if (it->isWorn())
{
it = Flare::flareList.erase( it);
// Flare::flareList.push_back( Flare());
}
not working ? Since erase is supposed to return a valid iterator or the
end of the list... I made a workaround but it doens't look so cool to me
bool through;
do
{
through = true;
for( it = Flare::flareList.begin() ; it != Flare::flareList.end(); it++)
if (it->isWorn())
{
it = Flare::flareList.erase( it);
// Flare::flareList.push_back( Flare());
through = false;
break;
}
}
while (!through);
That works but it's neither efficient nor pretty, so if anyone could
explain me what's going on in the first case and a better work around
thanks !
or whatever ; )
why is :
for( it = Flare::flareList.begin() ; it != Flare::flareList.end(); it++)
if (it->isWorn())
{
it = Flare::flareList.erase( it);
// Flare::flareList.push_back( Flare());
}
not working ? Since erase is supposed to return a valid iterator or the
end of the list... I made a workaround but it doens't look so cool to me
bool through;
do
{
through = true;
for( it = Flare::flareList.begin() ; it != Flare::flareList.end(); it++)
if (it->isWorn())
{
it = Flare::flareList.erase( it);
// Flare::flareList.push_back( Flare());
through = false;
break;
}
}
while (!through);
That works but it's neither efficient nor pretty, so if anyone could
explain me what's going on in the first case and a better work around
thanks !