On 8/5/18 10:48 AM, Alex wrote:
void main()
{
     Foo foo;
     assert(isFoo!foo);
     static struct X { int i; Foo foo; }
     X x;
     static foreach(i, item; typeof(x).tupleof)
         static if(is(typeof(item) == Foo))  // line A
             static assert(isFoo!item);      // line B
         else
             static assert(!isFoo!item);
}

I did try static foreach, but it doesn't work.

The difference here is you are using typeof(x).tupleof, whereas I want x.tupleof.

Note that in my real code, I do more than just the static assert, I want to use item as a reference to the real field in x.

-Steve

Reply via email to