opBinary failes with templates

Pelle pelle.mansson at gmail.com
Thu Jul 28 05:51:58 PDT 2011


On Wed, 27 Jul 2011 22:46:21 +0200, Steven Schveighoffer  
<schveiguy at yahoo.com> wrote:
> The proper workaround (and actually, the cleaner solution) is to use  
> Vector and not Vector!D.  Inside a template, the name of the template is  
> the same as if you invoked the template with the same template  
> parameters.
>
> If you actually do need a different value for D, I'm not sure what works.
>
> -Steve

It does not, for example:

struct matrix(uint m, uint n) {
     //...
     matrix!(n,m) transposed() {
         //...
     }
}

matrix(3,1) m;
m = m.transposed().transposed(); // doesn't work


More information about the Digitalmars-d mailing list