Tuple enumeration without integers or strings

Paul paultjeadriaanse at gmail.com
Sat Jan 2 21:41:34 UTC 2021


On Saturday, 2 January 2021 at 03:20:29 UTC, Paul Backus wrote:
> D's switch statement only works on strings and integers. For 
> more complex values, the easiest thing is to just use an 
> if-else chain.
>
> If you really want to use a switch statement, you can do it by 
> defining a function that maps each of your enum values to a 
> unique integer; for example:

Im afraid that would still result in issues when duplicate enum 
vlues are at play right?
(This issue would maybe warrant a compile time warning imho)


More information about the Digitalmars-d-learn mailing list