This is probably trivial or impossible Code Introspection...
WhatMeWorry via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Sep 19 22:21:03 PDT 2015
On Saturday, 19 September 2015 at 19:54:45 UTC, Adam D. Ruppe
wrote:
> On Saturday, 19 September 2015 at 19:52:56 UTC, WhatMeWorry
> wrote:
>> So I've got type and value of each member, but I want their
>> actual names?
>
> http://dlang.org/phobos/std_traits.html#FieldNameTuple
>
> You can also do something like `foo.tupleof[idx]["foo.".length
> .. $]` for an individual thing but the phobos one should be the
> nicest.
Thanks. But now I have an even more fundamental problem. I keep
getting a FieldNameTuple is not defined. But I've clearly got
the import statement. I even copied the example from Phobos
verbatim:
import std.traits;
struct S { int x; float y; }
static assert(FieldNameTuple!S == TypeTuple!("x", "y"));
But I still get the error.
Error: template instance FieldNameTuple!S template
'FieldNameTuple' is not defined
I've been working for hours on this stupid thing.
More information about the Digitalmars-d-learn
mailing list