Intelligent enums

Ignacious via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jan 18 18:59:04 PST 2017


I have the need to create an enum flag like structure to specify 
certain properties of a type easily.

e.g.,

enum properties
{
    Red,
    Blue,
    Hot,
    Sexy,
    Active,
    ...
}

But some properties will be mutually exclusive. I would like to 
contain all those rules for in the enum itself for obvious 
reasons(encapsulation).

I guess I'm going to be told to use static and structs, but I'm 
hoping for a more elegant solution.




More information about the Digitalmars-d-learn mailing list