Comment #0 by jcrapuchettes — 2013-03-26T09:40:25Z
Currently, the only way to access the field names inside a named tuple is to access the fieldSpecs alias, index a specific field, and then .stringof it.
Example:
---
auto t = Tuple!(int, "s", int, "d")(0, 1);
enum e = t.fieldSpecs[0].stringof;
pragma(msg, e);
---
Prints:
FieldSpec!(int, "s")
I propose that the template FieldSpec be moved from the private section of the Tuple struct to the public section. This would allow for the field names to be accessed directly through the FieldSpec template.
Example:
---
auto t = Tuple!(int, "s", int, "d")(0, 1);
enum e = t.fieldSpecs[0].name;
pragma(msg, e);
---
Prints:
s