Visual C++ find line causing “Debug Assertion failed”

I think the problem is that you are erasing members of the vector you are iterating through. What happens if you erase the first element?

i 1 2 3 Ei v1 v2 v3

If we erase 1 when i = 1, our vector indices and values are below and now i = 2.

i 1 2 Ei v2 v3

Ultimately, I think you can iterate past the end of the vector causing you to have a pointer that points past the end of the vector. Complete guess work here, but there is probably an easier way to do what you’re trying to do. I just can’t figure out what you’re trying to do.

It looks like you’re trying to invert the rows and columns of a two dimensional array while storing the diagonal polygons int he array into a new array. Anyway, yes, but a red circle at the beginning of the for loop and walk through your code line by line.

I would create temp vectors and then modify those ones in the for loop and then replace the vector openPolygonList.

Leave a Comment