I have a class CharMap and in its constructor I have this: vector< vector<char> > CharGrid(xres, vector<char>(yres)). I don't get any errors from initializing this vector, but whenever I try to access it like this: CharGrid[gety-1][getx-1] my application crashes. How do I access the elements of this multidimensional vector?
Your CharGrid is not populated.
You are accessing bounds that are not available.
Line 52 vector< vector<char> > CharGrid(xres, vector<char>(yres)); creates a completely different vector array that is only local to the constructor; not the object.
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
Process returned 0 (0x0) execution time : 0.047 s
Press any key to continue.