import std.conv; import std.traits; string exposeEnumMembersImpl(T)() { string result; foreach (member; EnumMembers!UITableViewRowAnimation) result ~= "alias " ~ to!string(T.stringof) ~ "." ~ to!string(member) ~ " " ~ to!string(member) ~ ";\n"; return result; }
template exposeEnumMembers(T) { enum exposeEnumMembers = exposeEnumMembersImpl!T(); } mixin( exposeEnumMembers!UITableViewRowAnimation ); I did notice something about mixins, they hide existing aliases. If you already had those aliases listed and you added this mixin, the newly mixed in aliases will not conflict with the old ones. I find this behavior rather odd, even if it's defined this way..