I wrote the following code. I want to delete some triangle from tempContainerOne which is described as a vector of triangles.

I can compilewithout error, but when run the program, it fails. WOuld any body help me identify the problem? Thanks.

Here is the code:

for(TriContainer::iterator cur_b = tempContainerOne->begin(); cur_b != tempContainerOne->end(); cur_b++){

Triangle& tri_2 = (*cur_b);
for(VerticeSet::iterator cur_a = startStripping.begin(); cur_a != startStripping.end(); cur_a++){

if ( (tri_2.vert[0] == (*cur_a)) || (tri_2.vert[1] == (*cur_a)) || (tri_2.vert[2] == (*cur_a)))

tempContainerOne->erase(cur_b);
}
}