newCTFE Status July 2017

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Sat Jul 22 05:34:33 PDT 2017


On Thursday, 13 July 2017 at 12:45:19 UTC, Stefan Koch wrote:
> [ ... ]

Hi Guys,

Another work-filled two day went by.
And here is the fruit of the labor:

int[2][3] split(int[6] a)
{
   int[2][3] result;
   foreach (i; 0 .. typeof(result[0]).length)
   {
     foreach (j; 0 .. result.length)
     {
       auto idx = i*result.length + j;

       result[j][i] = a[idx];
     }
   }
   return result;
}

static assert(split([1,2,3,4,5,6]) == [[1, 4], [2, 5], [3, 6]]);

The above code does now work at ctfe.

Meaning we are well on our way of supporting multidimensional 
arrays.
Multidimensional Slices however are a little tricker.


More information about the Digitalmars-d mailing list