On 2012-07-26 14:17, Wes wrote:
In general, no. But you can get a list of all members in a module or
class scope. Just use __traits(allMembers, ...);
The allMembers example was lacking fields. It only showed methods, so I
wasn't really sure. The problem with it was that it returned strings. I
suppose I can still use them in a mixin.
If you want to access the fields of a class or struct you can use .tupleof:
class Foo { int a; }
Foo.tupleof;
You can have a look how this is used in my serialization library Orange:
https://github.com/jacob-carlborg/orange/blob/master/orange/util/Reflection.d#L188
Interesting templates/functions would be:
* hasField
* fieldsOf
* TypeOfField
* nameOfFieldAt
* setValueOfField
* getValueOfField
--
/Jacob Carlborg