Is there a way to get the list of names of a class' member variables?

Philippe Sigaud philippe.sigaud at gmail.com
Sun Jul 4 10:04:41 PDT 2010


On Sun, Jul 4, 2010 at 12:55, Simen kjaeraas <simen.kjaras at gmail.com> wrote:

>
> __traits[1] is your friend in these matters.
>>
>> __traits( allMembers, Foo ) returns a tuple of string literals, each of
>> which corresponds to a member of Foo.
>>
>
>
Somehting I discovered today: it works for module names, also:

auto ioMembers = __traits(allMembers, std.stdio);

It also contains the unittests... Hmm, I wonder what one can do with that.


Philippe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20100704/f64fa960/attachment.html>


More information about the Digitalmars-d-learn mailing list