Class Data Members Name Reflection
"Nordlöw" via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jun 10 09:30:51 PDT 2014
On Tuesday, 10 June 2014 at 16:13:31 UTC, Adam D. Ruppe wrote:
> Two options: do allMembers and filter it out to only be data
> members, or do some slicing of tupleof.stringof:
What trait should I use to filter out data members?
> S s;
> foreach(idx, member; s.tupleof) {
> writeln("Name: ", s.tupleof[idx].stringof[2..$]);
> }
Ok.
I tried
foreach (ix, memb; arg.args[0].front.tupleof)
{
import std.stdio: writeln;
writeln(arg.args[0].front.tupleof[ix].stringof);
}
Almost there...except that the print seems to verbose and bit
funny:
ref FKind __tup4778 = front(arg._args_field_0);
, __tup4778.kindName
ref FKind __tup4779 = front(arg._args_field_0);
, __tup4779.description
ref FKind __tup4780 = front(arg._args_field_0);
, __tup4780.wikiURL
ref FKind __tup4781 = front(arg._args_field_0);
Did I do something wrong?
More information about the Digitalmars-d-learn
mailing list