STL iterator delete problem

years ago carl report problem in chinaunix.net: bug of stl on hpux.when delete some element in the stl containers,not work.others ok.

now i encount the problem again,but not bug.and the solution:

for(iterator continue)

{

if(want to delete)

{

delete the pointer;

delete the element and move on the cursor;

}

else

{

increment

}

}

and use the r iterator also will be ok.just because when you delete the elemetn.so the iteraotr changed,then error occurs

[@more@]