In the D language, what are the equivalents to the following statements assuming the code :-
int size = 8;
int shift = 1;
int[size] skip;
int[size] suff;
memcpy(&skip[0], &skip[0]+shift, (m-shift)*(int.sizeof));
memset(&skip[0]+(m-shift),0, shift*(int.sizeof))
I was thinking conversion would be :-
skip[0 .. size-1] = skip[shift .. size-1 ]; //For the memcpy();
skip[0 .. size-1] = 0; //For the memset();
But this doesn't seem to work for me as dmd(v2.066.1) gives the error slice [8..7] exceeds array bounds [0..8]
.
I assume
m
represents length of the array in yourmemcpy
/memset
code.Note that you'll get runtime error on first line if array bounds overlap.