Unhandled exception when resizing vector

Started by
1 comment, last by Mizipzor 18 years, 2 months ago
I got this line:

W[l].resize((NeuronsInHidden+1)*NeuronsInHidden);
When I step it through, the debugger says l = 1, NeuronsInHidden = 3. I added this line just above it: cout << W.size(); 4 is printed on screen. Still, I get an unhandled exception error at that first line. I shouldnt be accessing anything out of bounds here, what could be the problem?
Advertisement
You probably have a buffer overrun in the vector you're resizing which is getting flagged as heap corruption by the runtime library. Check to make sure that you aren't writing outside the vector bound elsewhere in your program.
This is in the constructor, can writing outside of boundries later in program caus problems here? Or is it enough to just check the code above it?

This topic is closed to new replies.

Advertisement