How can I distinguish an enum constant from an actual enum at compile time?
TheFlyingFiddle via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Oct 30 05:03:49 PDT 2015
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 mind if found out how:
pragma(msg, is(b == enum)); //True
pragma(msg, is(a == enum)); //False.
More information about the Digitalmars-d-learn
mailing list