Tuple fields/types

Jordan Wilson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jun 30 14:53:42 PDT 2016


Hello,

For tuples, does the fieldNames property have a 1-1 
correspondence with the Types property?

It appears that way in my testing:

alias MyData = Tuple!(string,"a",int,"b");
foreach (i, type; MyData.Types){
     writeln (MyData.fieldNames[i]," ",type.stringof);
     // a string
     // b int
}

But I can't figure out for sure from the documentation:

alias fieldNames = staticMap!(extractName, fieldSpecs);
alias Types = staticMap!(extractType, fieldSpecs);

Thanks,

Jordan


More information about the Digitalmars-d-learn mailing list