Metaprogramming get type and field at compile time
Ali Çehreli via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Oct 27 15:53:35 PDT 2015
On 10/27/2015 03:34 PM, bioinfornatics wrote:
> I use FieldTypeTuple and FieldNameTuple to get type and correponding
> field name but I fail to loop over these tuple.
You can use the .tupleof property and a compile-time foreach:
http://dlang.org/class.html (Search for .tuplof on that page)
http://ddili.org/ders/d.en/tuples.html#ix_tuples..tupleof
http://ddili.org/ders/d.en/tuples.html#ix_tuples.compile-time%20foreach
Ali
More information about the Digitalmars-d-learn
mailing list