G
groups
This small piece of code is troubling me.. is there anything wrong
with it??
After calling this method the contents ot the input vector are
completely screwed..
(CCountedCIG_CountZero() applies only to a few elements in the vector)
void UElementVector::ClearZeroCountElements(vector<CCountedCIG*>
&ioItemVec)
{
vector<CCountedCIG*>::iterator new_end = remove_if(ioItemVec.begin(),
ioItemVec.end(), CCountedCIG_CountZero());
for (vector<CCountedCIG*>::iterator it = new_end; it !=
ioItemVec.end(); it++)
{
delete *it;
*it = NULL;
}
ioItemVec.erase(new_end, ioItemVec.end());
}
Any help is much apreciated!
regards,
jan
with it??
After calling this method the contents ot the input vector are
completely screwed..
(CCountedCIG_CountZero() applies only to a few elements in the vector)
void UElementVector::ClearZeroCountElements(vector<CCountedCIG*>
&ioItemVec)
{
vector<CCountedCIG*>::iterator new_end = remove_if(ioItemVec.begin(),
ioItemVec.end(), CCountedCIG_CountZero());
for (vector<CCountedCIG*>::iterator it = new_end; it !=
ioItemVec.end(); it++)
{
delete *it;
*it = NULL;
}
ioItemVec.erase(new_end, ioItemVec.end());
}
Any help is much apreciated!
regards,
jan