enum inheritance

JS js.mdnq at gmail.com
Sun Jul 14 21:31:29 PDT 2013


On Monday, 15 July 2013 at 04:27:42 UTC, JS wrote:
> BTW, the usefulness is to group sub-enums into the same range. 
> This would make it easy/efficient to branch over a range in the 
> enum:
>
> if (v in colors.Red) { v is a color in red }
>
> instead of
>
> if (v is color.Red || v is color.RedOrange || ...)

I guess a more intelligent structure is needed so changes in the 
enum do not break binaries. (although this is already somewhat of 
an issue with enums as changes in order requires a re-compilation)


More information about the Digitalmars-d-learn mailing list