Protection attribute in another module
jmh530 via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Aug 28 13:12:01 PDT 2017
How do I get the protection status of function in another module?
Basically I have some code that loops through all the members of
another module and I want to be able to skip the ones that are
private.
The code below prints public for foo.
module A;
private void foo();
--------------------------------
module B;
import A;
void main()
{
import std.stdio : writeln;
foreach(member; __traits(allMembers, A))
{
writeln(member);
writeln(__traits(getProtection, member));
}
}
More information about the Digitalmars-d-learn
mailing list