I just want to hard code in a matrix using C++ (g++ 4.1.2), by default I went with a std::vector of std::vectors.
My guess is this can be done in one line I just don’t know the correct syntax.
For example:
(1,2,5)
(9,3,6)
(7,8,4)
I thought it might be something like this –
vector<int> v1(1,2,3);
vector<int> v2(4,5,6);
vector<int> v3(7,8,9);
vector<vector<int>> vA(v1,v2,v3);
Normally, I wold read this info out of a text file, but I need to manually put in the numbers by hand and I have to use g++ 4.1.2
If you’re not going to change the size or shape of this matrix and since you’re hard-coding the values anyway, you may be better with a plain old array:
Otherwise, Fred Nurk’s answer is what you are looking for.