April 24, 2007 Very minor Enum proposal | ||||
|---|---|---|---|---|
| ||||
I know there has been a lot of debris flying about fancy enums able to stringize their values etc, but I have a much more modest proposal.
I'd like to be able to get the value of an enum member as a the underlying type via a property, say '.val'.
This would allow me to use something like this:
const x = MyEnum.AMember.val;
Instead of this:
const x = cast(typeof(MyEnum.init)) MyEnum.AMember;
--bb
| ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply