Hello, i am new in D and i have a problem.
I would like to retrieve the names of the variables and their value.
But i can not retrieve the value of the array.

class Test
{
    public int a;
    public Test[] b;

    this()
    {
      a = 1;
      b = [new Test(), new Test()];
    }
}

//======================================================================

void Read(T)(T value)
{
   foreach(i, mm; value.tupleof)
   {
      writeln(__traits(identifier, value.tupleof[i]), " = ", mm);

      if(isArray!(typeof(mm)))
      {
          Read(mm[0]); //Error
      }
   }
}

void main(string[] args)
{
   Read(new Test());
}

Thank you for your help.

Reply via email to