This is an array struct template, this code compiles: struct Vec(size_t N) { void opBinary(string op:"~", size_t M)(int[M]) {} } void main() { Vec!2 a1; int[3] a2; a1 ~ a2; // OK }
But this code doesn't compile: struct Vec(size_t N) { void opBinary(string op:"~", size_t M)(Vec!M) {} } void main() { Vec!2 a1; Vec!3 a2; a1 ~ a2; // line 7, Error } DMD 2.049 shows: test.d(7): Error: cannot implicitly convert expression (a2) of type Vec!(3) to Vec!(M) Can you show me how to fix the second program? Bye and thank you, bearophile