code generalization

Saaa empty at needmail.com
Mon Jun 8 21:23:34 PDT 2009


meant this:
which of course also fails,
but I hope you get the jist

void setLength (T)( ref T array, int depth , int index[])
{
  if(depth > 0)
  {
    depth--;
    setLength (&array[index[0]], depth, index[1..$]);
  }
  else
  {
    if(array.length < index[0]) array.length = array.length * 2;
  }
} 




More information about the Digitalmars-d-learn mailing list