i have a program where every thing is working properly. i have a vector with some values. i use iterators and delete a specific value in the vector. here the loop runs infinitely only for some values. i dont know what is the problem.
sample code:
Expand|Select|Wrap|Line Numbers
- vector<int>::iterator Iterator;
- for( Iterator = vect[temp3].cmatch.begin();
- Iterator != vect[temp3].cmatch.end();Iterator++ )
- {
- if(*Iterator==temp2)
- vect[temp3].cmatch.erase(Iterator);
- }
i have some values in the cmatch which i compare with the value i want to delete and if equals i delete that value from the cmatch.
when i run this program and give all the input values it crashes and when i tried to debug it i found that this loop was going into infinite state.
i dont know what is the problem with this...
please help me as i have to submit my program within 2 days..
thank you in advance..