EnumToFlags
Basile B. via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jun 30 04:08:25 PDT 2016
On Thursday, 30 June 2016 at 02:39:22 UTC, JS wrote:
> I created a type that makes working with flags much easier.
> Please review for issues and enhancements. It would be nice to
> simplify the value size code.
>
> [...]
You can look at this, it's more or less the same concept:
https://github.com/BBasile/iz/blob/master/import/iz/enumset.d#L226
Two things that important:
- enum members are not always integer numbers.
- enum used as flags is only fast when members values are
consecutives.
I've recently discovered that it can even be used to make UDAs,
what a "yeah" ;)
More information about the Digitalmars-d-learn
mailing list