default cast in opCast
Basile B.
basile.b at gmx.com
Mon Dec 29 22:29:49 UTC 2025
On Monday, 29 December 2025 at 20:52:47 UTC, Adam D. Ruppe wrote:
> On Monday, 29 December 2025 at 20:29:16 UTC, Basile B. wrote:
>> auto opCast(T)()
>> {
>> static if (is(T == uint))
>
> try
>
> auto opCast(T : uint)() {
> return member;
> }
>
> isntead of all that. then the opCast only ever matches uint.
Well said but TBF, I forgot template constraints even exist.
Anyway casting `this` inside the body of opCast is so suspicious
that at least the messages should be better.
More information about the Digitalmars-d
mailing list