On Friday, 6 March 2020 at 13:03:22 UTC, drug wrote:
> Here x will be null. You can use `enforce(x !is null);` if you
> want exception.
or since enforce returns it thing, just do
B b = enforce(cast(B) x);
you can also check easily in if statements:
if(auto b = cast(B) x) {
// x was a b, use b in here
} else {
// x was not b, try something else
}