Accessing UDA of private field

David Nadlinger see at klickverbot.at
Mon Jan 7 07:42:49 PST 2013


On Monday, 7 January 2013 at 15:37:48 UTC, Tove wrote:
> but this seems to work too?
>
> import std.traits;
>
> struct my_struct
> {
> private:
>   @(1) int t1;
>   @(2) int t2;
>   @(3) int t3;
> }
> void main()
> {
>   foreach(m; __traits(allMembers, my_struct))
>     pragma(msg, __traits(getAttributes, __traits(getMember, 
> my_struct, m)));
> }

»private« means »accessible from this module« – are you running 
your tests with my_struct defined in a different module?

David


More information about the Digitalmars-d mailing list