Issue with traits usability
Márcio Martins
marcioapm at gmail.com
Wed Mar 21 15:36:01 UTC 2018
Hi!
How do I get past this?
static struct X {
int x;
private enum T = 1;
private alias M = string;
}
foreach (Member; __traits(allMembers, X)) {
pragma(msg, __traits(getProtection, __traits(getMember, X,
Member)));
}
Output:
public
private
c.d(1084): Error: argument string has no protection
c.d(1084): while evaluating pragma(msg,
__traits(getProtection, string))
What I want to achieve essentially is skip all X's aliases and
templates, but get everything else, like enums and data members.
How would I go about this in a robust way?
I actually want to skip aliases, and templates.
More information about the Digitalmars-d-learn
mailing list