Accessing UDA of private field
d coder
dlang.coder at gmail.com
Sun Jan 6 10:46:10 PST 2013
> You can use a string mixin:
>
> class Foo
> {
> int a;
> @(3) private int b;
> }
>
> void main()
> {
> writeln(mixin("__traits(getAttributes, " ~ Foo.tupleof[1].stringof ~
> ")")); // -> 3
> }
>
>
>
Hmm....
This works only when main is in the same file (and therefor module) as Foo.
Regards
- Puneet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130107/de037ec3/attachment.html>
More information about the Digitalmars-d
mailing list