On Thursday, 25 February 2016 at 04:32:24 UTC, Adam D. Ruppe wrote:
On Thursday, 25 February 2016 at 04:25:25 UTC, Nicholas Wilson wrote:
foreach(m; __traits(allMembers, ...)
{
    static if(is(m== enum))
}


That's close but not quite there... try

static if(is(typeof(__traits(getMember, Item, m)) == enum))

for member variables, or if you are looking at a type itself youcan leave off the typeof() bit.

what is this black magic???

static if(is(typeof(__traits(getMember, vulkan_input, m)) == enum))
{
writeln(typeof(__traits(getMember, vulkan_input, m))).stringof; //fails to compile
            writeln(m); //prints nothing
}

Reply via email to