On Wed, 01 Oct 2014 07:45:48 +0000
Mike James via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com>
wrote:

> so in the constructor...
> 
> this(size_t x, size_t y) {
>    mda = new MyDataArray[](x);
>          foreach(n, _; mda) mda[n].data.length = y;
> }
> 
> Is there a simpler way?
sorry, but no. btw, if MyDataArray is struct, you should do this:

  foreach (ref m; mda) m.data.length = y;

or even this:

  foreach (ref m; mda = new MyDataArray[](x)) m.data.length = x;


the thing is that without 'ref' you operates on the local copy, not on
the real array element.

Attachment: signature.asc
Description: PGP signature

Reply via email to