I have been reading a book called "C++ How To Program" by Paul and Harvey Deitel. I am stuck at page 357 because if I follow the book and try putting only {{ }} instead of {{{ }}}, I will receive an error:
too many initializers for 'std::array<std::array<int, 2>, 3>'
Why do I need to put 1 extra set of brackets in the initializer list? For example, if I tried to put only {{1,2},{3,4},{5,6}} instead of {{{1,2},{3,4},{5,6}}} I will get an error.
int main()
{
array<array<int, 2>, 3> a {{1,2},{3,4},{5,6}};
for(auto const& i : a)
{
for(auto const& j : i)
{
std::cout << j << '\t';
}
std::cout << std::endl;
}
}