On Thursday, 11 June 2015 at 07:57:47 UTC, Per Nordlöw wrote:
On Wednesday, 10 June 2015 at 22:03:52 UTC, Ali Çehreli wrote:
Another option:
void main()
{
auto a2 = new ubyte[5];
But this causes an extra zero-initialization of a2.
a2[] = 0xAA; // <-- Assign to "all elements"
Is
auto a2 = value.repeat(size).array;
better in this regard?
Yes, it uses `uninitializedArray()` if the length is known (which
it is for `repeat()`):
https://github.com/D-Programming-Language/phobos/blob/master/std/array.d#L111