Reading Atributes (UDA) of overloaded functions

Ozan via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Sep 17 05:40:23 PDT 2015


On Thursday, 17 September 2015 at 12:36:42 UTC, John Colvin wrote:
> On Thursday, 17 September 2015 at 11:47:40 UTC, Ozan wrote:
...
> use __traits(getAttributes, /*...*/) on each of the members of 
> the result of __traits(getOverloads, /*...*/)

Great! Thanks! Now it works:

	foreach (ov; __traits(getOverloads, Test, "testUDA")) {
		foreach (attr; __traits(getAttributes, ov)) {
			if (attr.stringof == "Att") writeln("Found Att");
			if (attr.stringof == "Att2") writeln("Found Att2");
			if (attr.stringof == "Att3") writeln("Found Att3");
		}
	}

Regards, Ozan


More information about the Digitalmars-d-learn mailing list