in a template argument, specify which object member to access?

cym13 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Feb 8 15:29:27 PST 2016


On Monday, 8 February 2016 at 22:46:06 UTC, cy wrote:
> On Monday, 8 February 2016 at 22:38:45 UTC, Mengu wrote:
>> i believe you can use __traits(getMember) there.
>
> Great! Should have refreshed before sending that reply...
>
> I wonder if mixin("a."~member) is better or worse than 
> __traits(getMember,a,member)...

I think I prefer the mixin version because it doesn't rely on 
compiler internals and is easier to read IMHO but this is very 
questionable.


More information about the Digitalmars-d-learn mailing list