30.08.2021 13:20, Oleg B пишет:
>
> ```d
> auto typeIndex(T)(in T val) if (is(T == SumType!Args, Args...))
> {
> return match!(v => staticIndexOf!(typeof(v), T.Types))(*(cast(T*)&val));
> }
> ```
A little tip: you can use just `cast()` to remove qualifiers:
```D
return match!(v => staticIndexOf!(typeof(v), T.Types))(cast()val));
```