When D feels unfinished: union initialization and NRVO

Kagamin spam at here.lot
Thu Mar 19 18:17:45 UTC 2020


On Thursday, 19 March 2020 at 13:34:11 UTC, kinke wrote:
> Another simple workaround:
>
> import core.lifetime : move;
>
> ...
> case Good.Baguette:
>     Foo f = { type_: type, f1: typeof(Foo.f1)("Hello World") };
>     return move(f);
> ...


case Good.Baguette:
   return (){
     Foo f = { type_: type, f1: typeof(Foo.f1)("Hello World") };
     return f;
   }();


More information about the Digitalmars-d mailing list