CTFE Status
Stefan Koch via Digitalmars-d
digitalmars-d at puremagic.com
Sun Nov 13 23:57:20 PST 2016
On Monday, 14 November 2016 at 05:27:15 UTC, Stefan Koch wrote:
> Assignment to Array.length works now :)
> the following code :
>
> uint[] makeArr()
> {
> uint[] arr;
> arr.length = 5;
> return arr;
> }
>
>
> pragma(msg, makeArr());
>
> results in :
>
> CTFE_DEBUG_MESSAGE : building Array of Length 5
> [0u, 0u, 0u, 0u, 0u]
Assignment now also works :)
uint[] MakeAndInitArr(uint length)
{
uint[] arr;
arr.length = length;
foreach(i;0 .. length)
{
arr[i] = i + 3;
}
return arr;
}
pragma(msg, MakeAndInitArr(12));
Output :
[3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
More information about the Digitalmars-d
mailing list