如何在堆上使用矢量分配矩阵

如何在堆上使用矢量分配矩阵

本文介绍了如何在堆上使用矢量分配矩阵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我想在堆上分配一个动态矩阵,似乎我做错了。
我试着做以下事情:
vector< vector< int *> > * distanceMatrix = new vector< vector< int *> > ;;

它在堆上分配一个矩阵,但矩阵本身为空,我想要矩阵为sizeXsize,但不能单独排序
尝试使用
向量< vector< Distance *> >感谢您的帮助

hey, i am trying to allocate a dynamic matrix on the heap and seems like i am doing something wrong.i try to do the following thing : vector< vector<int*> >* distancesMatrix=new vector< vector<int*> >;
it does allocate a matrix on the heap but the matrix itself is empty, i want the matrix to be sizeXsize but cant sort it alonewhen not trying to allocate it on the heap with using vector<vector<Distance*> > distance(size+1, vector<Distance*>(size+1, NULL));thanks for your help

推荐答案

尝试 vector< vector< int> >(size,size)

这篇关于如何在堆上使用矢量分配矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 09:44