On Monday, 15 May 2017 at 23:36:06 UTC, Stanislav Blinov wrote:
On Monday, 15 May 2017 at 21:38:52 UTC, Yuxuan Shui wrote:
Suppose I have a

struct A {
  @disable this(this);
} x;

How do I append it into an array?

Do I have to do

array.length++;
moveEmplace(x, array[$-1]);

?

moveEmplace is for moving an initialized object into an uninitialized one. Use the two-argument move() function:

move(x, array[$-1]);

Can I expand an array with uninitialized object? Or can I rely on the compiler to optimize the initialization away?

Reply via email to