How do you append to a dynamic array using move semantics?
cy via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Mar 23 16:26:11 PDT 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)
...?
More information about the Digitalmars-d-learn
mailing list