Can I check if a value is convertible to a valid value of an enum?

Meta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Sep 25 11:30:46 PDT 2015


On Friday, 25 September 2015 at 03:20:24 UTC, Nicholas Wilson 
wrote:
> find + EnumMembers should do the trick
> if ( (EnumMembers!SomeType).canFind(value))
> {
>     // ...
> }

Should be

if (only(EnumMembers!SomeType).canFind(value))
{
     //...
}


More information about the Digitalmars-d-learn mailing list