Code review: JSON unmarshaller
Jacob Carlborg
doob at me.com
Wed Oct 17 23:38:39 PDT 2012
On 2012-10-17 20:36, Tyler Jameson Little wrote:
> The mentioned solution doesn't account for shared fields from a super
> class:
>
> class A { int a; }
> class S { int b; }
>
> foreach (i, type; typeof(S.tupleof)) {
> enum name = S.tupleof[i].stringof[4..$];
> writef("(%s) %s\n", type.stringof, name);
> }
>
> This will print:
>
> (int) b
Just do something like this:
alias BaseTypeOf!(S) BaseType;
BaseType t = type;
And run the same loop again.
--
/Jacob Carlborg
More information about the Digitalmars-d-learn
mailing list