Hi
I had a doubt about deleting from vectors. I have three vectors of types: void*, bool and int. I insert into these three vectors together and when the vector of bool type has the value true, I want to delete the elements in that position from all these three vectors. Can anyone please help me do that.
iP, iM and iO are iterators. I tried the above method but only one element got deleted. I know why but I don't know how to fix that.
Please help.
I had a doubt about deleting from vectors. I have three vectors of types: void*, bool and int. I insert into these three vectors together and when the vector of bool type has the value true, I want to delete the elements in that position from all these three vectors. Can anyone please help me do that.
Code:
for(unsigned int i =0; i<Ptr.size() ; i++)
{
if(Bool[i]==1)
{
iP=Ptr.begin();
iP=Ptr.erase(iP+i);
iO=Int.begin();
iO=Int.erase(iO+i);
iM=Bool.begin();
iM=Bool.erase(iM+i);
}
}
Please help.
Comment