digitalmars.D.bugs - [Issue 9819] New: Allow access to named tuple's names.
- d-bugmail puremagic.com (37/37) Mar 26 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9819
http://d.puremagic.com/issues/show_bug.cgi?id=9819 Summary: Allow access to named tuple's names. Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: jcrapuchettes gmail.com 09:40:25 PDT --- 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 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 26 2013