D Documentation  
Copying
To copy the content of one array to another, you could use a for statement. But D copies arrays better and often faster, if you specify on both target sides which elements you are interested in:

int[20] foo;
int[3] bar;

bar[0..2]  = foo[5..7];

This copies foo[5], foo[6] and foo[7] to bar[0], bar[1] and bar[2].

Note: Do not use more than your variable can handle!
Note: You can not copy overlapping parts:

int[2] foo;
int[5] bar;

foo[0..3] = bar[1..4];    // invalid!!

bar[0..3] = bar[1..4];    // also invalid!

And you can copy all elements at once too:

int[3] bar;
int[3] foo;

bar[]     = foo[];        // copies all elements :-)

See also:
Array Slicing, Array Settings and Operations
Created using PHP docwiki written by Markus Dangl. Best viewed with Mozilla Firefox.