array depth template

Saaa empty at needmail.com
Thu Jun 11 18:15:57 PDT 2009


Is this a good way to get the depth of an array?

int getArrayDepth(T)(ref T array)
{
static if( is(T A:A[]) )
{
A arr;
return 1 + getArrayDepth(arr);
}
else
{
return 0;
}
return -1;
} 




More information about the Digitalmars-d-learn mailing list