I'm checking the results from the static code analysis tool Klocwork.
It complains about the following code:
293 for( my_vector_typedef::iterator it( start_pos ); it != end_pos ; ++it ){
294 delete *it;
295 }
With the following message:
Object 'it._M_current' is used after it was freed. Object 'it._M_current' was used at line 293 after being freed by passing argument 1 to function 'delete' at line 294
I know things (especially iterators) in STL sometimes aren't really what they seem so I would like to understand what goes on. Purposely formulating the question silly - The 'delete' is performed on what 'it' is pointing at, and not 'it' itself, so why would it complain about it being used with '++it'? It's not it that has been deleted?