Accessing UDA of private field

Jacob Carlborg doob at me.com
Mon Jan 7 05:36:47 PST 2013


On 2013-01-07 12:59, Tove wrote:

> in which context does private fail? I'm using something like this:
>
> struct my_struct
> {
> private:
>    @(1) int t1;
>    @(2) int t2;
>    @(3) int t3;
> }
>
> foreach(m; __traits(allMembers, my_struct))
>    with(my_struct.init)
>      pragma(msg, __traits(getAttributes, mixin(m)));

Using a mixin works.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list