static struct S(T, size_t r, size_t c) { enum rows = r; enum cols = c; T opIndex(size_t i, size_t j) const {return T.init;} alias at = opIndex; } alias Matrix2i = S!(int, 2, 2); static assert(ETOperatorSpec!(Matrix2i, "+", Matrix2i) == ETOSpec.matrixAddMatrix); static assert(ETOperatorSpec!(Matrix2i, "-", Matrix2i) == ETOSpec.matrixSubMatrix); static assert(ETOperatorSpec!(Matrix2i, "*", Matrix2i) == ETOSpec.matrixMulMatrix); static assert(ETOperatorSpec!(Matrix2i, "*", int) == ETOSpec.matrixMulScalar); static assert(ETOperatorSpec!(int, "*", Matrix2i) == ETOSpec.scalarMulMatrix);
式テンプレートでの演算子の種類を返します