How to move append to an array?

Yuxuan Shui via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon May 15 20:42:22 PDT 2017


On Tuesday, 16 May 2017 at 01:34:50 UTC, Stanislav Blinov wrote:
> On Tuesday, 16 May 2017 at 01:22:49 UTC, Yuxuan Shui wrote:
>
>> Can I expand an array with uninitialized object? Or can I rely 
>> on the compiler to optimize the initialization away?
>
> Built-in arrays always default-initialize their elements. If 
> you need something that unsafe, there's 
> std.array.uninitializedArray:
>
> http://dlang.org/phobos/std_array.html#uninitializedArray
>
> What are you trying to achieve?

I just wish ~= could take moved objects.


More information about the Digitalmars-d-learn mailing list