TDPL: Operator Overloading
Steven Schveighoffer
schveiguy at yahoo.com
Wed Aug 25 05:54:58 PDT 2010
On Tue, 24 Aug 2010 18:43:49 -0400, Andrej Mitrovic
<andrej.mitrovich at whatever.com> wrote:
> 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).
Inside a template instantiation, the template name without template
parameters is equivalent to the current instantiation.
It saves a lot of typing.
-Steve
More information about the Digitalmars-d-learn
mailing list