Getting only the data members of a type

Artur Skawina art.08.09 at gmail.com
Sun Apr 1 06:15:49 PDT 2012


On 04/01/12 14:10, Jacob Carlborg wrote:
> On 2012-04-01 11:27, Artur Skawina wrote:
> 
>> That's because the compiler won't accept "foreach (i, t; S.tupleof)" and
> 
> But it accepts "foreach (i, t; typeof(S.tupleof))".

It does - thank you.

This means that that ugly null-to-pointer cast from my example can go,
and all that's needed is:

   foreach (i, type; typeof(S.tupleof)) {
      enum name = S.tupleof[i].stringof[4..$];
      writef("(%s) %s\n", type.stringof, name);
   }

artur


More information about the Digitalmars-d-learn mailing list