__traits(getMember)

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Wed Nov 2 12:49:24 PDT 2016


On 2016-11-02 17:30, Márcio Martins wrote:
> Can we get a getMember and a getOverloads that won't check for
> visibility or anything else?
>
> __traits appears really powerful, but every-time I try to use it for
> anything other than a toy example or very simple serialization, it seems
> like everything falls apart due to some detail... and I end up having to
> hack it up with string mixins and static if(is(typeof(() { some_code; }))).

For serialization, where you most likely only need to access the fields, 
you can use .tupleof which will bypass the protection.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list