Do array literals still always allocate?

Eugene Wissner via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun May 14 05:02:03 PDT 2017


On Sunday, 14 May 2017 at 11:45:12 UTC, ag0aep6g wrote:
> On 05/14/2017 01:40 PM, Nicholas Wilson wrote:
>> dynamic array literals is what I meant.
>
> I don't follow. Can you give an example in code?

void main()
{
     ubyte[] arr = [ 1, 2, 3, 4, 5 ];

     assert(arr == [ 1, 2, 3, 4, 5 ]);
}

Both, assignment and comparison, allocate.


More information about the Digitalmars-d-learn mailing list