oops :p correction: in template Zero const float[M][N] ==> const T[M][N]
rouge wrote:
Hi, I'm a newbie, hope the attached example works for you. Peter Alexander wrote:Since default constructors for structs are not allowed, how do I go about making all the elements of this Matrix struct default to zero? (floats default to nan by default).struct Matrix(int M, int N) { float[M][N] elements; } Matrix(3, 3) m; assert(m[0][0] == 0); ?