Is it correct that given the code below, the compiler should generate Node()
which should call std::array<Node *, 100>()
which should initialize all 100 pointers to nullptr.
Side note: I know that I can make that happen if I use std::array<Node *, 100> children {};
, but I am not trying to get my code to work (it already does), I am trying to make sure that it's not working by accident.
struct Node
{
int value;
std::array<Node *, 100> children;
}
Update:
Here pointers are garbage:
struct Node
{
int value;
std::array<Node *, 100> children;
}
struct Node
{
Node() : children() {}
int value;
std::array<Node *, 100> children;
}
Here pointers are nullptr:
struct Node
{
int value;
std::array<Node *, 100> children {};
}
struct Node
{
Node() : children{} {}
int value;
std::array<Node *, 100> children;
}
Please, correct me if I am wrong.