Dynamic array handling

seany seany at uni-bonn.de
Thu Nov 14 13:38:38 PST 2013


In Very High level languages, such as scilab, you can write

array_var = (1,2,3 ... etc)

and then you can also write

array_var = array_var(1:2,4:$)

In this case, the third element is dropped, and the same 
variable, array_var is set to be an array of a different length, 
resizing of array and so on is automated.

Is the same possible to be done in D?

say,

int [] a ; //initialize;

a ~= 1;
a ~= 2; //etc, polulate

. . . say, we fill up 10 such elements

Now, can you do like,

a = somefunction_that_drops_the_4th_element(a); // a is reset,
                                                 // and the length
                                                 // is reorganized 
automatically


More information about the Digitalmars-d-learn mailing list