I'm having some trouble initializing an object with an array in one line, can someone help me figure out the syntax?
The class is below:
struct Matrix4 { float mElements[16]; Matrix4(float mElements[]) { memset(&this->mElements, 0, sizeof(this->mElements)); for (int i = 0; i < 16; i++) this->mElements[i] = mElements[i]; } } I'm trying to initialize it this way:
Matrix4 mMatrix = Matrix4({1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1}); The error I get is:
no instance of constructor "Matrix4::Matrix4" matches the argument list Thanks,
std::arrayimplementation for examplememsetis completely pointless. Why zero-fill an array you're about to fill in entirety.