Some strange parameter deduction problems in opOpAssign and opBinary

Philippe Sigaud philippe.sigaud at gmail.com
Sun Sep 2 00:44:36 PDT 2012


> Problem solved:
>
> alias Vec!(T, size) V;
>
> // This works fine
> ref V opOpAssign(string op)(V rhs)
>
> {
>         mixin("array[] "~op~"= rhs.array[];");
>                 return this;
> }

Inside a template, you can refer to the current (local) instantiation by
its name only. Try using 'Vec' instead of V. Does this work?

If you want to force the use of another instantiation, I personally put a
dot ('.') before the template: this is the 'global scope' operator and the
compiler will 'step out' of the current template.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20120902/51f8c3c7/attachment.html>


More information about the Digitalmars-d-learn mailing list