digitalmars.D.learn - Idiomatic way to check for UDA?
- Tofu Ninja (5/5) Jun 06 2015 Whats the idiomatic way to check if an identifier has a specific
- ketmar (8/13) Jun 06 2015 there is `std.traits.hasUDA` added to phobos recently. but until officia...
- "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> (4/14) Jun 07 2015 Service:
- ketmar (3/16) Jun 07 2015 thank you, i should provide the links from the start, so OP can copypast...
Whats the idiomatic way to check if an identifier has a specific UDA attached to it. Also what should I use to define a UDA that doesn't need to carry any data? Just an empty template? Or does something else make more sense?
Jun 06 2015
On Sun, 07 Jun 2015 05:32:46 +0000, Tofu Ninja wrote:Whats the idiomatic way to check if an identifier has a specific UDA attached to it. =20 Also what should I use to define a UDA that doesn't need to carry any data? Just an empty template? Or does something else make more sense?there is `std.traits.hasUDA` added to phobos recently. but until official=20 release you have to write your own `hasUDA`. alas. as for defining UDA without data, you can use this trick: enum MyUDA; MyUDA int i; as it doesn't really need to be semantically analyzed, this forward=20 declaration can work just fine.=
Jun 06 2015
On Sunday, 7 June 2015 at 06:20:55 UTC, ketmar wrote:On Sun, 07 Jun 2015 05:32:46 +0000, Tofu Ninja wrote:Service: https://github.com/D-Programming-Language/phobos/pull/3356 https://github.com/D-Programming-Language/phobos/pull/3363Whats the idiomatic way to check if an identifier has a specific UDA attached to it. Also what should I use to define a UDA that doesn't need to carry any data? Just an empty template? Or does something else make more sense?there is `std.traits.hasUDA` added to phobos recently.
Jun 07 2015
On Sun, 07 Jun 2015 11:37:29 +0000, Marc Sch=C3=BCtz wrote:On Sunday, 7 June 2015 at 06:20:55 UTC, ketmar wrote:thank you, i should provide the links from the start, so OP can copypaste=20 the code.=On Sun, 07 Jun 2015 05:32:46 +0000, Tofu Ninja wrote:=20 Service: https://github.com/D-Programming-Language/phobos/pull/3356 https://github.com/D-Programming-Language/phobos/pull/3363Whats the idiomatic way to check if an identifier has a specific UDA attached to it. =20 Also what should I use to define a UDA that doesn't need to carry any data? Just an empty template? Or does something else make more sense?there is `std.traits.hasUDA` added to phobos recently.
Jun 07 2015