Initialisation of std::array<>
问题 Consider the following code: #include <array> struct A { int a; int b; }; static std::array<A, 4> x1 = { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } }; static std::array<A, 4> x2 = { { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } } }; static std::array<A, 4> x3 = { A{ 1, 2 }, A{ 3, 4 }, A{ 5, 6 }, A{ 7, 8 } }; static std::array<A, 4> x4 = { A{ 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } }; Compiling with gcc: $ gcc -c --std=c++11 array.cpp array.cpp:15:1: error: too many initializers for ‘std::array<A, 4ul>’ }