forward tuple arg to local variable + dtor

Ali Çehreli acehreli at yahoo.com
Sat Jan 22 17:23:12 UTC 2022


On 1/22/22 07:17, vit wrote:

 > Why local variable of type tuple call destructors immediately after
 > initialization?

I don't even understand where the local variable comes from. If you want 
a pair of Foo objects, I would use std.typeconst.Tuple.

Otherwise I would use AliasSeq as I understand it like the following:

         alias tup = AliasSeq!(Foo, Foo);

         static foreach(Type; tup) {{
           Type x;
           writeln("check(", x.i, "): ", cast(void*)&x);
         }}

So, to me, AliasSeq!(Foo, Foo) is just a pair of types. I instantiate an 
object for each type individually and use it inside.

Ali



More information about the Digitalmars-d-learn mailing list