Make a type tuple from an array

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Apr 10 08:13:50 PDT 2015


Is there a way to turn an array (known at compile time) into a 
TypeTuple? I want to do a static foreach over it, like this:

     foreach(field; fields) {
         static if(is(mixin("T." ~ field.name))) { ... }
     }

Obviously that won't work, because we don't have a real static 
foreach yet.

I already worked around it with a string mixin, but I'd like to 
know whether there's a cleaner way...


More information about the Digitalmars-d-learn mailing list