I have this constructor:
Transform::Transform( float matrix[4][4] )
{
m = matrix;
}
And this class definition:
class Transform
{
float m[4][4];
public:
Transform();
Transform(float matrix[4][4]);
But this does not compile.
What could be wrong?
Error 1 error C2440: ‘=’ : cannot convert from ‘float [][4]’ to ‘float [4][4]’ c:\Users\Josh\Documents\agui\trunk\src\Agui\Transform.cpp 75
Thanks
If you are using c++11 try to change
float matrix[4][4]tostd::array<std::array<float,4>,4>It is a mouthful, but it supports such operations that c arrays do not natively support.
You could do something like this to clean up the syntax.
Now you can do
p.s If you are not using C++11, you could use
vectorinstead ofarray. It is a little different from array, but adds more features as well, and after you set it up access is identical.