Resizable Arrays?

BCS ao at pathlink.com
Fri Feb 27 16:35:13 PST 2009


Reply to tim,

> Theres nothing stopping you from having all your arrays static in D. I
> think your crazy :)
> 

I think the thought is that arrays can have dynamic length but can't be changed 
after allocation.

starting with:

int[] arr = new int[15];

assigning to length

arr.length = 30;

would always become

auto tmp = new int[30];
tmp[0..min(arr.length,$)] = arr[0..min(tmp.length,$)];
arr = tmp;





More information about the Digitalmars-d mailing list