On 2012-12-17 12:55, d coder wrote:

template Tuple(T...) {
   alias T Tuple;
}

enum Bar;
class Foo {
   @Bar int a;
   int b;
}

void main() {
   Foo foo = new Foo;
   foreach(ref l; foo.tupleof) {
     alias Tuple!(__traits(getAttributes, l)) tp;
     pragma(msg, tp);// prints nothing
   }
   alias Tuple!(__traits(getAttributes, foo.a)) tp;
   pragma(msg, tp);             // prints (Bar)
}


Try something like this:

foreach (i, dummy, foo.tupleof)
{
    alias Tuple!(__traits(getAttributes, foo.tupleof[i])) tp;
    pragma(msg, tp);
}

--
/Jacob Carlborg

Reply via email to