CTFE Status 2
Stefan Koch via Digitalmars-d
digitalmars-d at puremagic.com
Fri Apr 28 10:53:04 PDT 2017
On Thursday, 16 February 2017 at 21:05:51 UTC, Stefan Koch wrote:
> [ ... ]
Hi Guys, I just implemented sliceAssigment.
meaning the following code will now compile:
uint[] assignSlice(uint from, uint to, uint[] stuff)
{
uint[] slice;
slice.length = to + 4;
foreach (uint i; 0 .. to + 4)
{
slice[i] = i + 1;
}
slice[from .. to] = stuff;
return slice;
}
static assert(assignSlice(1, 4, [9, 8, 7]) == [1, 9, 8, 7, 5, 6,
7, 8]);
More information about the Digitalmars-d
mailing list