ddos:
one possible solution would be a static if, like this:TVector opBinary(string op)(TVector rhs) { static if(n == 4) { // fast impl for n==4 } else { // old impl } }but i'd like to avoid this since it makes the code very ugly to readany suggestions :) ?
You can add a template constraint and write two functions: TVector opBinary(string op)(TVector rhs) if(n == 4) {... TVector opBinary(string op)(TVector rhs) if(n != 4) {...} Bye, bearophile