Default constructor for structs

Peter Alexander peter.alexander.au at gmail.com
Sat Aug 7 06:34:49 PDT 2010


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);

?


More information about the Digitalmars-d-learn mailing list