We know std::array<double, N> Can be initialized to all-zero by
std::array<double, N> my_array {}
My question is if I have
std::array<std::array<double, N>, M> my_array {}
Doess the above guarantee the nested array is also all initialized to 0.0? If so, how does the {} work in this scenario? If not, what can I achieve that?
{}works in this scenario the usual way for aggregate initialization (which is part of list-initialization) syntax.std::arrayis demanded by standard to be aggregate. So you get 2 levels of aggregate initialization due to default construction request and zeroing on 3rd level for default construction request on fundamental types.