opIndexMember

claptrap clap at trap.com
Tue Dec 29 10:41:44 UTC 2020


On Monday, 28 December 2020 at 20:15:27 UTC, Per Nordlöw wrote:
> On Sunday, 27 December 2020 at 14:46:43 UTC, claptrap wrote:
>> So basically if opIndexMember is defined for Foo then...
>>
>> foo[i].x
>>
>> Is rewritten to..
>>
>> foo.opIndexMember!("x")(i);
>
> For an alternative solution see:
> https://github.com/nordlow/phobos-next/blob/master/src/nxt/soa.d
>
> No benchmarks yet, tough, but you're very welcome to add them.

Hi, that works perfectly, and in godbolt, LDC -O3, identical 
codegen to just accessing the array directly.




More information about the Digitalmars-d mailing list