std.sumtype?

Oleg B code.viator at gmail.com
Mon Aug 30 11:19:46 UTC 2021


On Monday, 30 August 2021 at 10:50:40 UTC, drug wrote:
> A little tip: you can use just `cast()` to remove qualifiers:
> ```D
> return match!(v => staticIndexOf!(typeof(v), 
> T.Types))(cast()val));
> ```

I'm not sure what with simple `cast()` not `opCast` nor ctors are 
called, it depends on code of `SumType`, if it changed they can 
be called (not sure). Cast through pointer avoid it. Or I mistake?


More information about the Digitalmars-d mailing list