TDPL: Operator Overloading
Andrej Mitrovic
andrej.mitrovich at whatever.com
Tue Aug 24 15:43:49 PDT 2010
Yao G. Wrote:
> That's a bug. The return value should be CheckedInt(result);
I'll add that to the errata.
Yao G. Wrote:
>
> http://www.digitalmars.com/d/2.0/mixin.html
I wasn't refering to the mixin, but the call to CheckedInt(). mixin compiles "value" ~ op ~ "rhs.value", which in this case evaluates to 5 + 5 and the whole call becomes CheckedInt(10).
What I don't understand is how you can construct a new CheckedInt struct by calling it with CheckedInt(10), when I have to use a call like CheckedInt!(int)(10) outside the struct (in main or in a unittest block).
More information about the Digitalmars-d-learn
mailing list