Get attributes of a field?

Jacob Carlborg doob at me.com
Tue Apr 2 18:46:48 UTC 2019


On 2019-04-02 15:23, Alex wrote:
> __traits(getAttributes, T)
> 
> Requires a type and a field is unfortunately not a type ;/

enum attr;

struct Foo
{
     @attr int a;
}

void main()
{
     alias a = __traits(getAttributes, Foo.a);
}

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list