default cast in opCast

Steven Schveighoffer schveiguy at gmail.com
Wed Dec 31 13:30:26 UTC 2025


On Monday, 29 December 2025 at 20:29:16 UTC, Basile B. wrote:
> D could define that `this` cast within an `opCast` should 
> fallback to the default, i.e that ignores the operator 
> overload. Example
>
> [...]

cast(T)cast(Object)this

And you can probably avoid the dynamic cast by checking if 
implicit cast works first.

Though I think Adam’s solution is better.

-Steve


More information about the Digitalmars-d mailing list