Hey :) I've only been learning C++ for a week, and here is some code I wrote. I get an error saying the vector iterator is out of range. The error happens when the value of k and nZeros are both 5, possibleGrid[i][j].size()=4.
int nZeros = 0;
for (int k = 0; k < Size; k++)
{
if (possibleGrid[i][j][k - nZeros] == 0)
{
nZeros++;
possibleGrid[i][j].erase(possibleGrid[i][j].begin() + k - nZeros); //something here is wrong!!
}
}
Any help would be much appreciated :)
Aucun commentaire:
Enregistrer un commentaire