find all public properties at compile time

anonymous via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Sep 30 13:19:04 PDT 2014


On Tuesday, 30 September 2014 at 20:04:29 UTC, gedaiu wrote:
> [sorry... this is the edit for the prev post]
>
> Thank you for your response!
>
> I don't think that it helps me...
>
> I wanted to get an array like this [ "a", "b", "c" ] for this
> class
>
> class test {
>
> int a;
> string b;
> double c;
>
> }

import std.typetuple: staticMap;
enum stringOf(alias thing) = thing.stringof;
static assert([staticMap!(stringOf, test.tupleof)] == ["a", "b",
"c"]);


More information about the Digitalmars-d-learn mailing list