 <p>Simplest solution is to use the dynamic array and call the <code>.reserve</code> method before doing any appends. Then it will preallocate the space and future appends will be cheap.</p> <pre><code>void main() { MyStruct[] structs; structs.reserve(256); // prealloc memory foreach(id; 0 .. 256) structs ~= MyStruct(id); // won't reallocate } </code></pre> <p>That's how I'd do it with dynamic arrays, writing to individual members I don't think will ever work with immutability involved like this.</p> <p>BTW if you wanted a static array, calling reserve won't work, but you can explicitly initialize it.... to <code>void</code>. That'll leave the memory completely random, but since you explicitly requested it, the disabled default constructor won't stop you. (BTW this is prohibited in <code>@safe</code> functions) But in this case, those immutable members will leave it garbage forever unless you cast away immutability to prepare it soo.. not really workable, just a nice thing to know if you ever need it in the future.</p>