Skip to content

Instantly share code, notes, and snippets.

@zakky-dev
Created December 31, 2013 19:06
Show Gist options
  • Save zakky-dev/8200943 to your computer and use it in GitHub Desktop.
Save zakky-dev/8200943 to your computer and use it in GitHub Desktop.
UDAの利用テスト。
import std.stdio;
enum udaprop = "udaprop";
class UDATest {
@udaprop private int intProperty;
@udaprop private string stringProperty;
private float floatProperty;
}
void main() {
string[] udaprops;
foreach(p; __traits(derivedMembers, UDATest)) {
auto attr = __traits(getAttributes, mixin("UDATest." ~ p));
foreach(a; attr) {
if(a == "udaprop") {
udaprops ~= p;
break;
}
}
}
udaprops.writeln;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment