For a 2d vector, I know I can go:
vector<vector<T>> vec;
vec = vector<vector<T>> (boardSize, vector<T>(boardSize));
But how do I do it for a 3d vector?
I tried
vector<vector<vector<T>>> vec;
vec = vector<vector<vector<T>>> (boardSize, boardSize, vector<T>(boardSize));
But it wouldn’t compile. Any ideas?
Just a guess:
That means, when you’ve declared a
vector<vector<T>>, the second argument should be avector<T>; and when you declared avector<vector<vector<T>>>, the second argument should be avector<vector<T>>, which in turn should be as in the first case.