On 01/20/2013 03:41 AM, Ali Çehreli wrote:
... void main() { auto ship = new Ship; alias T = typeof(ship);foreach (m; __traits(allMembers, T)) { writefln("member %s", m); enum atrs = __traits(getAttributes, mixin(T.stringof ~ "." ~ m));
This only works because Ship happens to be defined in the same module. Use __traits(getMember, T, m) instead of the mixin.
foreach (a; atrs)
{
writefln(" attribute %s", a);
if (is(typeof(a) == Bind))
Engine.bindActors(ship, a.pattern);
}
}
}
Ali
