I wonder if this construction:
std::array<int, 10> array { };
is 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 << ", ";
}
Out:
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
I know that to initialize std::array by selected values I must use double curly brackets because of aggregate initialization. But I don't know how it behaves with single brackets. So, the question is:
Is this totally correct to initialize struct by single curly brackets in C++11? (this follows that all field of struct will be zeroed)
Edit: As @dyp noted my question in post is more general. Let's assume that my question is about structs with only trivial elements.