C++: constructor initializer for arrays
问题 I\'m having a brain cramp... how do I initialize an array of objects properly in C++? non-array example: struct Foo { Foo(int x) { /* ... */ } }; struct Bar { Foo foo; Bar() : foo(4) {} }; array example: struct Foo { Foo(int x) { /* ... */ } }; struct Baz { Foo foo[3]; // ??? I know the following syntax is wrong, but what\'s correct? Baz() : foo[0](4), foo[1](5), foo[2](6) {} }; edit: Wild & crazy workaround ideas are appreciated, but they won\'t help me in my case. I\'m working on an