The code is below
The error is "Expression must have class type" on the line:
if (index >= mElements.size())
But not on the line return mElements[index]
I dont understand why, is this a glitch?
struct Matrix4x4
{
float mElements[16];
Matrix4x4()
{
memset(&this->mElements, 0, sizeof(this->mElements));
this->mElements[0] = 1;
this->mElements[5] = 1;
this->mElements[10] = 1;
this->mElements[15] = 1;
}
Matrix4x4(const float (&mElements)[16])
{
for (int i = 0; i < 16; i++)
this->mElements[i] = mElements[i];
}
float& operator[](int index)
{
if (index >= mElements.size()) {
printf("Array index out of bound, exiting");
return 0.0F;
}
return mElements[index];
}
}