is there a way to use sumtype in `switch/case` (with multiple statements)? or how can I get the `tag` and `storage`?

mw m at g.c
Sat Oct 7 19:30:23 UTC 2023


On Saturday, 7 October 2023 at 19:25:51 UTC, mw wrote:
> Or how can I get the `tag` and `storage` myself?
>
> https://github.com/dlang/phobos/blob/a3f22129dd2a134338ca02b79ff0de242d7f016e/std/sumtype.d#L310
>

If I add this line to the above func `isF`:

```
   writeln(t.tag);
```

it won't compile:

sum_type.d(79): Error: no property `tag` for `t` of type 
`std.sumtype.SumType!(Fahrenheit, Celsius, Kelvin)`




More information about the Digitalmars-d-learn mailing list