C++:vector + vector二维数组的初始化

时间:2024-03-17 07:11:40

 

1. vector二维数组初始化方法:

C++:vector + vector二维数组的初始化


2.示例代码

unsigned int rows = costMatrix.rows();

unsigned int cols = costMatrix.cols();

vector< vector<double> > costFunc(rows,vector<double>(cols,0));

for (unsigned int i = 0; i < rows; ++i)

{

    for (unsigned int j = 0; j < cols; ++j)

    {

        costFunc[i][j] = (double)costMatrix(i,j);

    }

}

 

参考:

1.

2.https://blog.csdn.net/onlyongwang/article/details/80936443

 

 

 

 

相关文章