__traits(getMember, ...) on instance member

%u wfunction at hotmail.com
Sat Jan 15 21:15:25 PST 2011


Hi,

Something has been confusing me, regarding passing around aliases of instance
members.

If I can say:

  struct S { int m; }
  pragma(msg, (S).m);

How come I can't say:

  struct S { int m; }
  pragma(msg, __traits(getMember, S, m));

?
What's the difference, and what does each one mean?

(I'm trying to create a MembersTuple(T) template that returns a tuple of all
members, but this stumbling block is pretty much fatal to my implementation.)

Thank you!


More information about the Digitalmars-d-learn mailing list