std::array supports aggregate initialization, but what is the problem here? If code (1) is used, both vc10.0 and g++ 4.7.2 complain that too many initializers. But if I use code (2) instead, everything is OK.
#include <array>
struct elem_t { char c; unsigned n;};
struct my_struct_t
{
int i;
// std::array<elem_t, 2> a; // (1) cause error
// elem_t a[2]; // (2) ok
};
int main()
{
std::array<int, 3> ai[] = {{1,2,3},{4,5,6}}; // ok
my_struct_t var[] =
{
{ 0, { {'a',1U}, {'b',2U}} }, // in question?
};
}