正しい構文を教えてください。これがこれまでのコードです
enum Color {WHITE, BLACK};
struct Square
{
Square(Color p_color): color_(p_color) {}
Color color_;
};
//instead of Square *, is there a clear way to express intention that function returns
//Square[][]
Square[][] initSquare(const int rows, const int cols)
{
Square board[rows][cols]; //Why does compiler complain that Square does not
//have a default constructor? I am just declaring an
//array of type Square
for(int row=0;row<rows;row++)
for(int col=0;col<cols;col++)
{
if(col%2 == 0)
board[row][col]= Square(WHITE);
else
board[row][col] = Square(BLACK);
}
return board;
}