Im creating my own matrix library for education purposes. I created a constructor that accepts a 4x4 matrix in the form of
Matrix(float initMatrix[4][4]){
//init operation here
}
The above constructor works fine when creating the object by creating a 2D array and then using that variable to initialize this object, for example:
float my_matrix[4][4] = {{...},{...},{...},{...}}; //shortened for brevity
Matrix matrix(my_matrix);
However, it fails to build when doing the following:
Matrix matrix({{...},{...},{...},{...}});
The compiler tells me
> cannot convert initializer list argument to 'float (*)[4]'
So I added another constructor that looks like this:
Matrix matrix(float matrix(*)[4]){}
I end up getting the following compiler error.
error: C++ requires a type specifier for all declarations
Vytrix(float input(*)[4]){
Can someone show me a good flexible way of designing the constructors so that I can initialize the class in a clean way?