Successively prepending to slices.

dnspies dspies at ualberta.ca
Wed Apr 9 16:18:25 PDT 2014


I know that D slices are set up so you can successively append to 
them and it only has to re-allocate infrequently, but what about 
with prepending?

ie, does D have a way to handle

int[] x;
for(int i=0; i < 1000; i++) {
   x = [i] ~ x;
}

efficiently, or is it better to avoid this sort of thing?


More information about the Digitalmars-d-learn mailing list