Class Data Members Name Reflection

Kapps via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 10 19:07:26 PDT 2014


On Tuesday, 10 June 2014 at 20:01:37 UTC, Nordlöw wrote:
>
> Notice that A.init.tupleof segfaults for classes so that is 
> _not_ an adviced solution in a generic solution!
>

There's no need to use .init:

import std.stdio;

struct Foo {
	int a, b;
}

void main() {
	writeln(__traits(identifier, Foo.tupleof[0]));
}


More information about the Digitalmars-d-learn mailing list