In Expressions

Basile B. via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Mar 5 04:11:17 PST 2017


On Saturday, 4 March 2017 at 19:31:46 UTC, Andrey wrote:
> On Saturday, 4 March 2017 at 17:57:16 UTC, John Colvin wrote:
>> but to be honest, I would just repeat myself a bit and write
>>
>> if (regionAlign == RegionAlign.top ||
>>     regionAlign == RegionAlign.bottom) {
>> }
>
> That's exactly what I did, just wondered - how to do such a 
> thing.
> Thank's for the detailed explanation.

Run this through DUB:

```
/+dub.sdl:
name "dub_script"
dependency "iz" version="~master"
+/
module dub_script;

enum RegionAlign
{
     top, botttom, left, right
}

import iz.enumset;
alias Set = EnumSet!(RegionAlign, Set8);

void main(string[] args)
{
     with(RegionAlign)
     {
         Set set = [top, left];
         assert(top in set);
         assert(left in set);
     }
}
```

iz.enumset.EnumSet seems to be what you need. (assuming Region 
align is a named enum...)


More information about the Digitalmars-d-learn mailing list