I have something like deq.push_back(object)
which works fine in a source file but not in another one - if I try the same operation there I get the runtime error in the title. How can it be possible? deq
is a global variable in the source file where the code works. Just as a test, I tried to swap the global declaration and the extern between the source files and I get the same result, the second source file triggers the ru开发者_运维技巧ntime error. What am I missing here? Why I can't use push_back from there?
Is it possible that you have moved the deq.push_back(object)
statement to within a loop and thus modifying the container invalidates the loop iterator?
精彩评论