Re: Get attributes of a field?

2019-04-02 Thread Jacob Carlborg via Digitalmars-d-learn

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


Re: Get attributes of a field?

2019-04-02 Thread Andre Pany via Digitalmars-d-learn

On Tuesday, 2 April 2019 at 13:36:47 UTC, Alex wrote:

On Tuesday, 2 April 2019 at 13:23:37 UTC, Alex wrote:

__traits(getAttributes, T)

Requires a type and a field is unfortunately not a type ;/


I'd like to be able to get the attributes without having to 
instantiate the base type because that is problematic and I see 
no reason why it has to be instantiated to get CT values.


Could you provide a full example for this issue and for your 
other message? That makes it easier to help you


Kind regards
Andre


Re: Get attributes of a field?

2019-04-02 Thread Alex via Digitalmars-d-learn

On Tuesday, 2 April 2019 at 13:23:37 UTC, Alex wrote:

__traits(getAttributes, T)

Requires a type and a field is unfortunately not a type ;/


I'd like to be able to get the attributes without having to 
instantiate the base type because that is problematic and I see 
no reason why it has to be instantiated to get CT values.


Get attributes of a field?

2019-04-02 Thread Alex via Digitalmars-d-learn

__traits(getAttributes, T)

Requires a type and a field is unfortunately not a type ;/