Thread overview
How do you append to a dynamic array using move semantics?
Mar 23, 2016
cy
Mar 23, 2016
ag0aep6g
Mar 24, 2016
ag0aep6g
Mar 24, 2016
cy
March 23, 2016
struct Thing {
  @disable this(this);
}
...
items ~= move(item); // Error: struct Thing is not copyable because it is annotated with @disable

++items.length
move(items[$-1],item); // Error: struct Thing is not copyable because it is annotated with @disable

appender(items).put(move(item)); // Error: template std.array.Appender!(Thing[]).Appender.put cannot deduce function from argument types !()(Thing)

...?
March 24, 2016
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]);`.
March 24, 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.
March 24, 2016
On Wednesday, 23 March 2016 at 23:44:55 UTC, ag0aep6g wrote:
> You got the order of arguments wrong here. Source goes first,

Oh, derp. Thanks. Right then... it works as expected.