E.g.:

enum Metrics : int 
{
        SM_CXSCREEN = 0,
        SM_CYSCREEN,
        SM_CXVSCROLL,
        SM_CYHSCROLL,
        SM_CYCAPTION,
        SM_CXBORDER,
}

void foo(int m)
{
}

void main()
{
    foreach (m; Metrics)
    {
        foo(m);
    }
}

This won't work.

I know there's traits to get strings at compile time, e.g.:
auto b = [ __traits(allMembers, Metrics) ];

but this doesn't help me try out those enum values at runtime. It could almost 
work if I could use a mixin() in a foreach loop, but that's lucid dreaming.

Another alternative might be to create an array out of the enum, but I don't 
know of any way of doing this.

Reply via email to