我如何在另一个数组中插入多维数组(int不为char)

||                                                                                                                       
已邀请:
        
// 2D int array
typedef std::vector<std::vector<int> > twoDarray;

// 1D array **of 2D arrays, not ints **
std::vector<twoDarray> oneDarray;

// Instance of 2D array
oneDarray myOneDArray;

// Instance of 2D array
twoDarray myTwoDArray;

// Add this in.
myOneDArray.push_back(myTwoDArray);
    
        当您说插入时,我假设您的意思是“代表”。只要以某种方式在2D索引和1D索引之间进行1对1映射,就可以用多种方法在1D数组中表示2D数组。例如:
storage[row*column_count + column]
在1D数组(或the3ѭ)中将数据存储在ѭ2处的典型,简单方法。     

要回复问题请先登录注册