Any workarounds for non-static member array initialization?
<p>In C++, it's not possible to initialize array members in the initialization list, thus member objects should have default constructors and they should be properly initialized in the constructor. Is there any (reasonable) workaround for this apart from not using arrays?</p>

<p>[Anything that can be initialized using only the initialization list is in our application far preferable to using the constructor, as that data can be allocated and initialized by the compiler and linker, and every CPU clock cycle counts, even before <code>main</code>. However, it is not always possible to have a default constructor for every class, and besides, reinitializing the data again in the constructor rather defeats the purpose anyway.]</p>

<p>E.g. I'd like to have something like this (but this one doesn't work):</p>

<pre><code>class OtherClass {
private:
    int data;
public:
    OtherClass(int i) : data(i) {}; // No default constructor!
};

class Foo {
private:
    OtherClass inst[3]; // Array size fixed and known ahead of time.
public:
    Foo(...)
        : inst[0](0), inst[1](1), inst[2](2)
        {};
};
</code></pre>

<p>The only workaround I'm aware of is the non-array one:</p>

<pre><code>class Foo {
private:
    OtherClass inst0;
    OtherClass inst1;
    OtherClass inst2;
    OtherClass *inst[3];
public:
    Foo(...)
        : inst0(0), inst1(1), inst2(2) {
        inst[0]=&amp;inst0;
        inst[1]=&amp;inst1;
        inst[2]=&amp;inst2;
    };
};
</code></pre>

<p><b>Edit</b>: It should be stressed that <code>OtherClass</code> has no default constructor, and that it is very desirable to have the linker be able to allocate any memory needed (one or more static instances of <code>Foo</code> will be created), using the heap is essentially <i>verboten</i>. I've updated the examples above to highlight the first point.</p>
