首页 > 解决方案 > 无法转换 'std::vector(*)[2]' 到 'std::vector**' 用于参数 '1' 到 'void getNextRowColumn(std::vector**)'

问题描述

标签: c++vector

解决方案


I guess you want to pass C array as an argument to a function then you need something like

void fn()
{
    vector<ArrayIndex> IntermediateIndex[2];
    getNextRowColumn(IntermediateIndex);
}

void getNextRowColumn(vector<ArrayIndex>*  IntermediateIndex)
{
}

But since the question is tagged C++ you better stick to C++ semantics, for example

void fn()
{
    array<vector<ArrayIndex>, 2> IntermediateIndex;
    getNextRowColumn(IntermediateIndex);
}

void getNextRowColumn(array<vector<ArrayIndex>, 2>&  IntermediateIndex)
{
}

Or use vector<vector<…&gt;>, depends on what you are going to do with it


推荐阅读