How can I distinguish an enum constant from an actual enum at compile time?

2015-10-30 Thread TheFlyingFiddle via Digitalmars-d-learn
I want to be able to do something like this: enum a = 32 enum b = { q,w,e,r,t,y } CtType ctype = getCtType!(a); // -> Would become CtType.enumConstant CtType ctype1 = getCtType!(b); // -> Would become CtType.enum_

Re: How can I distinguish an enum constant from an actual enum at compile time?

2015-10-30 Thread TheFlyingFiddle via Digitalmars-d-learn
On Friday, 30 October 2015 at 11:46:43 UTC, TheFlyingFiddle wrote: I want to be able to do something like this: enum a = 32 enum b = { q,w,e,r,t,y } CtType ctype = getCtType!(a); // -> Would become CtType.enumConstant CtType ctype1 = getCtType!(b); // -> Would become CtType.enum_ Never

Re: How can I distinguish an enum constant from an actual enum at compile time?

2015-10-30 Thread Gary Willoughby via Digitalmars-d-learn
On Friday, 30 October 2015 at 12:18:21 UTC, Gary Willoughby wrote: On Friday, 30 October 2015 at 12:03:50 UTC, TheFlyingFiddle wrote: pragma(msg, is(b == enum)); //True pragma(msg, is(a == enum)); //False. enum isEnum(alias e) = is(e == enum); isEnum!(a) isEnum!(b) ;) isEnum!(isEnum)

Re: How can I distinguish an enum constant from an actual enum at compile time?

2015-10-30 Thread Gary Willoughby via Digitalmars-d-learn
On Friday, 30 October 2015 at 12:03:50 UTC, TheFlyingFiddle wrote: pragma(msg, is(b == enum)); //True pragma(msg, is(a == enum)); //False. enum isEnum(alias e) = is(e == enum); isEnum!(a) isEnum!(b) ;)