I am currently attempting to create a class containing a 2D vector of structs, however I am clearly doing something tragically wrong as whenever I run my code, I get the error at line 19 (the line in the for loop in the world constructor) error: expected primary-expression before ‘)’ token
Here is my code at the moment:
#include <iostream>
#include <vector>
struct Cell{
bool isAlive;
Cell(bool alive){
isAlive = alive;
}
};
class World{
unsigned width;
unsigned height;
std::vector<std::vector<Cell>> state;
public:
World(unsigned w,unsigned h){
width = w;
height = h;
for (int i = 0; i<h; i++){
state.push_back(std::vector<Cell>);
}
}
};
I know that I haven't yet fully initialised the 2nd dimension of the vector, but I'm just trying to get this working at the moment.
Thank you so much, I honestly have no clue what this error means.