Interesting work on packing tuple layout

Timon Gehr timon.gehr at gmx.ch
Sat Jun 13 23:30:38 UTC 2020


On 13.06.20 21:11, Andrei Alexandrescu wrote:
> https://github.com/ZigaSajovic/optimizing-the-memory-layout-of-std-tuple
> 
> Would be interesting to adapt it for std.tuple.
> 

That's likely to run into the following arbitrary language limitation:

---
alias Seq(T...)=T;
struct T{
     int a,b;
     alias expand=Seq!(b,a);
}
void main(){
     import std.stdio;
     writeln(T(1,2).expand);
}
---
Error: need `this` for `b` of type `int`
Error: need `this` for `a` of type `int`
---

Another question is if automatic packing is worth making the layout 
harder to predict.


More information about the Digitalmars-d-announce mailing list