Interestingly, this design:
std::array<int, 10> array { };
equivalent to this:
std::array<int, 10> array { { } };
Well, both of them compile, and both of them give the same result:
for (auto e : array) {
std::cout << e << ", ";
}
Of:
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
I know that to initialize std :: array with the selected values I have to use double curly braces due to aggregate initialization. But I do not know how this works with single brackets. So the question is:
Is this completely correct for initializing the structure with single curly braces in C ++ 11? (this means that all fields of the structure will be reset to zero)
Edit: As @dyp noted, my post question is more general. Suppose my question is about structures with only trivial elements.