enum detection

bearophile bearophileHUGS at lycos.com
Thu Nov 22 08:34:00 PST 2012


Jack Applegame:

> How to detect enum member?
>
> struct A {
>   enum id = 10;
>   int b;
>   char c;
> }
> foreach(ident; __traits(allMembers, A)) {
>   // is ident enum or not?
> }

Have you tried is(ident == enum) ?

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list