How do you append to a dynamic array using move semantics?

ag0aep6g via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Mar 23 17:08:38 PDT 2016


On 24.03.2016 00:44, ag0aep6g wrote:
> On 24.03.2016 00:26, cy wrote:
>> ++items.length
>> move(items[$-1],item); // Error: struct Thing is not copyable because it
>> is annotated with @disable
>
> You got the order of arguments wrong here. Source goes first, target
> second. Works for me with `move(item, items[$-1]);`.

Though it should compile the other way around, too. And it does for me.


More information about the Digitalmars-d-learn mailing list