Consider:
#!/Users/aalexandre/bin/rdcc
import std.conv, std.stdio;
struct A
{
A* next;
bool b;
@disable this(this);
}
struct B
{
A a;
}
void main()
{
A a;
emplace(&a, A(null, false));
B b;
emplace(&b, A());
}
Both calls fail to compile. These calls to emplace should work because they don't need to postblit stuff around - they could just move from the rvalues received.
Comment #1 by monarchdodra — 2014-04-24T06:24:28Z
(In reply to Andrei Alexandrescu from comment #0)
> Consider:
>
> #!/Users/aalexandre/bin/rdcc
> import std.conv, std.stdio;
>
> struct A
> {
> A* next;
> bool b;
> @disable this(this);
> }
>
> struct B
> {
> A a;
> }
>
> void main()
> {
> A a;
> emplace(&a, A(null, false));we
> B b;
> emplace(&b, A());
> }
>
> Both calls fail to compile. These calls to emplace should work because they
> don't need to postblit stuff around - they could just move from the rvalues
> received.
Hum... looks like you are asking for emplace to know how to elide postblit... It *should* be doable, but it's kind of hard: I'll try to look into making it work. It's necessary for making it function with "opCall()" anyways.
In the meantime, you could just:
emplace(&a, null, false); //emplace from args
emplace(&b); //construct by default
I'll look into making it work. First case should be "easy-ish". The second seems harder...
(In reply to monarchdodra from comment #2)
> Not mandatory, but would be quite helpful, this needs fixing first:
> https://issues.dlang.org/show_bug.cgi?id=12684
Yah, they kinda go together.