So, User-Defined Attributes

Walter Bright newshound2 at digitalmars.com
Fri Jan 4 12:51:54 PST 2013


On 1/4/2013 8:04 AM, Philippe Sigaud wrote:
> So, I'm testing how to transfer UDA from one symbol to another.

Remember, attributes are attached to the declaration. They are not transferred 
through initializers.

This will do the transfer:

import std.stdio;
void main()
{
     @(3, "hello") int i = 10;
     @(__traits(getAttributes, i)) double d2;
     writeln("[",__traits(getAttributes, d2), "]");
}


More information about the Digitalmars-d mailing list