I'm trying to initiate a 3d vector in c++. I'm wanting it to initially be a 100 by 100 by 1, but I'm running into problems. (I know that's 2d basically, but I'll resize the z axis vector later.)
I have a class, Entity, that the vector should contain a pointer to. I've included the Entity vector headers correctly, but it's still not working. Here's what I'm trying to do:
vector <vector <vector <Entity* > > > matrix (100, vector < vector < Entity* > > (100,vector<Entity*> (1, NULL)));
The error the compiler is giving is "expected identifier before numerical constant". I checked closely, and there are no missing semicolons or anything before this line. If I remove this line, the code compiles cleanly.
This is directly after the "private:" line in a function definition. Can member variables accept constructors? I also tried putting just
vector <vector <vector <Entity* > > > matrix;
in the .h file, and
matrix (100, vector < vector < Entity* > > (100,vector<Entity*> (1, NULL)));
in the constructor in the .cpp file, but that didn't work either (no match for call, and invalid conversion from int to Entity*)
What's the best way to declare a 3d "vector" of this (especially in a class?)
Thanks!