09-22-2013, 12:55 AM
Здравствуй.
This means that your code is buggy. The assert means that you have an iterator that is invalid; this usually happens when iterating through a container and deleting from the container at the same time, either from two threads, or even from one thread. You cannot have a for-loop over the container, inside which you delete items from that container - this invalidates the iterators.
I don't think the code that you've posted is the only cause of this, there's nothing immediate that would indicate a problem.
Of course the asserts only fire in debug mode, that's the point of asserts - they check conditions that shouldn't happen and may be costly to check, so they are compiled in only in debug mode; in release they are left out, meaning the program will crash or otherwise misbehave instead.
This means that your code is buggy. The assert means that you have an iterator that is invalid; this usually happens when iterating through a container and deleting from the container at the same time, either from two threads, or even from one thread. You cannot have a for-loop over the container, inside which you delete items from that container - this invalidates the iterators.
I don't think the code that you've posted is the only cause of this, there's nothing immediate that would indicate a problem.
Of course the asserts only fire in debug mode, that's the point of asserts - they check conditions that shouldn't happen and may be costly to check, so they are compiled in only in debug mode; in release they are left out, meaning the program will crash or otherwise misbehave instead.