Created
December 31, 2013 19:06
-
-
Save zakky-dev/8200943 to your computer and use it in GitHub Desktop.
UDAの利用テスト。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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