On 2014-04-04 04:31, Walter Bright wrote:
On 4/3/2014 7:19 PM, bearophile wrote:
I have asked for fully typesafe enums in D,

You can do this:

    struct MyInt {
        int x;
        alias this x;
        ... put your various constraints here ...

to get typesafe enums. In fact, you can use this construct to create a
type that overrides selected behaviors of any other type.

For a more complete implementation of typesafe enums, here's my take:



Reply via email to