"Christopher Wright" <[email protected]> wrote in message
news:[email protected]...
> Saaa wrote:
>> I just finished my array parser but I can't support just any depth
>> because each depth needs its own code the way I am doing it now :(
>
> Recursion?
> static if (is (U A : A[])) will give you int[] for int[][], so you can
> recursively call the parsing function with A as the type argument rather
> than U.
My attempt to rewrite the switch (failed : )
ddata\ddata.d(94): Error: slice expression array[] is not a modifiable
lvalue
ddata\ddata.d(169): template instance ddata.ddata.setLength!(int[]) error
instantiating
//an array depth walker :)
void setLength (T)( ref T array, int depth , int index)
{
if(depth > 0)
{
depth--;
setLength (array[], depth, index); //94
}
else
{
if(array.length < index) array.length = array.length * 2;
}
}