On 12/03/2012 04:43 PM, js.mdnq wrote:
When accessing an element outside a dynamic array I get an exception.I thought in D arrays will automatically expand themselves? If not, how do I add an element to an array? int[] arr = new int[1]; arr[1] = 34; // exception
Another option is to modify the length of the "slice" (yes, "slice", not "array"):
arr.length = 100; The following is almost mandatory reading: :) http://dlang.org/d-array-article.html Ali