Interesting work on packing tuple layout

Max Samukha maxsamukha at gmail.com
Mon Jun 15 13:57:01 UTC 2020


On Monday, 15 June 2020 at 13:50:07 UTC, Andrej Mitrovic wrote:

> typeof(t[0]) works fine, but reading or assigning to such a 
> field will not work. For example:
>
> void main() {
>     Tuple!(byte, int, short) t;
>     writeln(t[0]);
> }
>
>> test.d(57,23): Error: need `this` for `__value_field_2` of 
>> type `byte`

It should work. This works:

void main() {
     Tuple!(byte, int, short) t;

     t[0] = 0;
     t[1] = 2;
     t[2] = 3;

     auto a0 = t[0];
     auto a1 = t[1];
}
}


More information about the Digitalmars-d-announce mailing list