I have the following code. Basically I want to initialize a std::array of non-POD structs using aggregate initialization syntax. Both g++ 4.6 and 4.7 (latest weekly snapshot) fa
std::array
is an aggregate containing an array, so you need an extra pair of braces to initialise it from a regular array:
{1,2} // TheClass
{{1,2},{2,3}} // TheClass[2]
{{{1,2},{2,3}}} // std::array<TheClass,2>
{{{{1,2},{2,3}}}} // OtherClass<2>
However, it seems that older versions of GCC still stuggle with this: 4.5.1 rejects it, while 4.6.1 accepts it.