如何使用非类型参数将数组数组传递给模板 class

How to pass array of arrays to a template class with non-type parameters

我假设下面的代码可以初始化 Matrix class,但是对于 Matrix C 我得到以下代码:

error C2440: 'initializing': 无法从 'initializer list' 转换为 'Math::Linear::Matrix<int,2,2>'

        template<class T, unsigned int Rows, unsigned int Cols>
        class Matrix
        {
        public:
            Matrix(std::array<std::array<T,Cols>,Rows> ArrayArray)
            {
            
            }
        }

    std::array<std::array<int, 2>, 2> A = {{ {{1,1}} , {{1,1}} }};
    Matrix<int, 2, 2> B = A;
    Matrix<int, 2, 2> C = {{ {{1,1}} , {{1,1}} }};

要使用初始化列表初始化,你还需要一个{ }

std::array<std::array<int, 2>, 2> A = {{ {{1,1}} , {{1,1}} }}  ;
Matrix<int, 2, 2> C =               { {{ {{1,1}} , {{1,1}} }} };