Protection attribute in another module

jmh530 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Aug 29 16:15:37 PDT 2017


On Tuesday, 29 August 2017 at 15:48:05 UTC, Kagamin wrote:
> You iterate over string literals: 
> https://dlang.org/spec/traits.html#allMembers

I had known that, but I couldn't figure out how to get the 
identifiers. It turns out that I can loop over getOverloads and 
it produces the desired result (below).

module B;

import A;

void main()
{
     import std.stdio : writeln;

     foreach(member; __traits(allMembers, A))
     {
         foreach (t; __traits(getOverloads, A, member))
         {
             writeln(__traits(getProtection, t));
         }
     }
}


More information about the Digitalmars-d-learn mailing list