I have defined the following struct and its default constructor:
struct State
{
State()
{
// Initialize both stacks with unit matrices
objStack.push(Matrix(1, 1, 1, SCALE));
lightStack.push(Matrix(1, 1, 1, SCALE));
}
std::stack<Affine> objStack;
std::stack<Affine> lightStack;
int maxDepth = 5;
std::unique_ptr<Point[]> vertices = nullptr;
Colour ambient = Colour(0.2);
};
If the constructor I declared is executed when I instantiate a State struct, will the last 3 variables still be initialized with 5, nullptr and Colour(0.2)? Or should my constructor look like this:
State()
{
// Initialize both stacks with unit matrices
objStack.push(Matrix(1, 1, 1, SCALE));
lightStack.push(Matrix(1, 1, 1, SCALE));
maxDepth = 5;
vertices = nullptr;
ambient = Colour(0.2);
}
I'm not sure about what will happen here.