Difficulty copying multi dimensional static array to dynamic array.

Derek Parnell derek at nomail.afraid.org
Mon Feb 25 14:39:49 PST 2008


On Mon, 25 Feb 2008 23:11:11 +0100, Saaa wrote:

> Using ref should do the trick without pointers.

I agree, but the compiler explicitly disallows using ref with static
arrays. Try it yourself. Seems unreasonable to me and no one has explained
it to me why this must be so.

void fillArray(ref float[4][4] data)
{
  for (int i = 0; i < 4; i++)
      for (int j = 0; j < 4; j++)
        data[i][j] = 0.0;
  
}
void main()
{
    float[4][4] m1;
    fillArrary( m1 );
}

I get the message "Error: cannot have out or ref parameter of type
float[4u][4u]"


-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
26/02/2008 9:33:53 AM


More information about the Digitalmars-d-learn mailing list