switch with enum
Meta via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Nov 25 12:06:47 PST 2015
On Wednesday, 25 November 2015 at 20:00:01 UTC, Meta wrote:
> One way you could do it:
>
> import std.conv: to;
>
> try
> {
> switch (userValue.to!Status)
> {
> ...
> }
> }
> catch (ConvException c)
> {
> //Default case
> }
...Which doesn't work because it won't compile without a default
case. Is this a recent change? I don't remember D doing this
before.
More information about the Digitalmars-d-learn
mailing list