{ auto msg = boxed("asdf"); auto asCast = cast(Boxed!string)msg; assert((msg !is null), "Incorrectly cast message: " ~ typeof(asCast).stringof); asCast = null; // silence dscanner } { auto msg = boxed(123_456); auto asCast = cast(Boxed!int)msg; assert((msg !is null), "Incorrectly cast message: " ~ typeof(asCast).stringof); asCast = null; // silence dscanner } { struct Foo {} auto msg = boxed(Foo()); auto asCast = cast(Boxed!Foo)msg; assert((msg !is null), "Incorrectly cast message: " ~ typeof(asCast).stringof); asCast = null; // silence dscanner }
Deprecated alias to boxed.