Re: Finding UDAs with Templates

2013-07-23 Thread Paul O'Neil
I basically ended up doing what Jacob suggested. To deal with the extra members from "mixin Signal" by using the compiles trait to avoid the normal case for them. Thanks for the help. Paul

Re: Finding UDAs with Templates

2013-07-23 Thread Jacob Carlborg
On 2013-07-23 12:59, Artur Skawina wrote: We can. :) enum attrs = __traits... // `auto` would work too. I can't remember that working for me, but perhaps it does. Just be careful and remember the `typeof(attrs)` part if/when using staticIndexOf with types - it might otherwise return bog

Re: Finding UDAs with Templates

2013-07-23 Thread Artur Skawina
On 07/23/13 08:38, Jacob Carlborg wrote: > static bool doesFieldSync (string field) () > { > alias attrs = TypeTuple!(__traits(getAttributes, mixin("FileData." ~ > field))); > return staticIndexOf!(Sync, attrs) != -1; > } > > The important things here are that __traits(getAttributes) retu

Re: Finding UDAs with Templates

2013-07-22 Thread Jacob Carlborg
On 2013-07-23 06:27, Paul O'Neil wrote: I'm trying to write some code that finds all the members of a class that have a particular user defined attribute. My current attempt is at https://github.com/todayman/d_template_experiments/tree/8fccd27d7d5557ec6e2f0614374cf5f79fe80b4c I would like to h