Usability of "allMembers and derivedMembers traits now only return visible symbols"

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 5 01:38:25 PDT 2016


On 2016-09-04 14:36, Andrei Alexandrescu wrote:

> Yah, .tupleof is great to have. I think that should be enough for most
> introspection needs. Only the field names are missing, can those be
> accessed somehow? -- Andrei

Yes:

module foo;

struct Foo
{
     private int a;
}

module main;

import foo;
static assert(__traits(identifier, Foo.tupleof[0]) == "a");

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list