Thanks for all the help, I have moved my initializations down to the Constructor, however, I’m having difficulties defining the 2D vector:
Here is what I have done:
private:
vector < vector <int> > Matrix;
vector < vector <int> > temp_m;
vector <int> elements
string input;
int value;
function()
{
//Initialize Both Matrices (one which holds the puzzle and the
//other which holds the values between 1 and 9
//Create a vector of vectors:
for(int i = 0; i < 9; i++)
elements.push_back(i+1);
for(int i = 0; i < 9; i++)
Matrix[i].push_back(elements); //ERROR HERE
}
I’m getting an error in the line where I define the 2D matrix. I want to push back matrix into its indices since its a matrix of a matrix.
The declaration of “row” and its construction are not in the same place. Construction belongs on an initializer list:
If you have any other special sizing or initialization of member variables the require construction parameters (such as your Matrix and temp_e above) they belong in the initializer list as well.