digitalmars.D.learn - Get attributes of a field?
- Alex (2/2) Apr 02 2019 __traits(getAttributes, T)
- Alex (4/6) Apr 02 2019 I'd like to be able to get the attributes without having to
- Andre Pany (5/12) Apr 02 2019 Could you provide a full example for this issue and for your
- Jacob Carlborg (12/15) Apr 02 2019 enum attr;
__traits(getAttributes, T) Requires a type and a field is unfortunately not a type ;/
Apr 02 2019
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.
Apr 02 2019
On Tuesday, 2 April 2019 at 13:36:47 UTC, Alex wrote:On Tuesday, 2 April 2019 at 13:23:37 UTC, Alex wrote:Could you provide a full example for this issue and for your other message? That makes it easier to help you Kind regards Andre__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.
Apr 02 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
Apr 02 2019