I have code that compiles and is executable using both GCC 4.8.1 and 4.8.4 (Gentoo). When I run the code on the system using 4.8.1 I don't get an out_of_range error and the program runs fine. When I compile and run it on a server using 4.8.4 I get the error:
terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check
Abort
I've also compiled and run it in Visual Studio 2012, again with no errors. I'm wondering what might be causing the discrepancy. At first, I thought it might be an issue with comparisons using .size(), so I cast them all to int, but the issue still isn't resolved. Does anyone have any idea what might be causing this?
Edit:
Here's a snippet of the kind of code I'm using. It's pretty uniform throughout. Just some standard for loops and vectors:
// Resize points based on number of dimensions
for( int k = 0; k < (int)points.size(); k++ )
points.at(k).resize((int)countVec.size());
Aucun commentaire:
Enregistrer un commentaire