[英]cannot convert ‘std::vector<ArrayIndex> (*)[2]’ to ‘std::vector<ArrayIndex>**’ for argument ‘1’ to ‘void getNextRowColumn(std::vector<ArrayIndex>**)’
I have我有
struct ArrayIndex
{
int rowIndex;
int columnIndex;
};
void fn()
{
vector<struct ArrayIndex> IntermediateIndex[2];
getNextRowColumn(&IntermediateIndex);
}
void getNextRowColumn(vector<ArrayIndex>* IntermediateIndex[2])
{
.................
}
It gives error cannot convert 'std::vector<ArrayIndex> (*)[2]' to 'std::vector<ArrayIndex>**' for argument '1' to 'void getNextRowColumn(std::vector<ArrayIndex>**)'
它给出错误cannot convert 'std::vector<ArrayIndex> (*)[2]' to 'std::vector<ArrayIndex>**' for argument '1' to 'void getNextRowColumn(std::vector<ArrayIndex>**)'
I guess you want to pass C array as an argument to a function then you need something like我猜您想将 C 数组作为参数传递给函数,然后您需要类似的东西
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但是由于问题被标记为C++
您最好坚持使用 C++ 语义,例如
void fn()
{
array<vector<ArrayIndex>, 2> IntermediateIndex;
getNextRowColumn(IntermediateIndex);
}
void getNextRowColumn(array<vector<ArrayIndex>, 2>& IntermediateIndex)
{
}
Or use vector<vector<…>>
, depends on what you are going to do with it或者使用vector<vector<…>>
,取决于你打算用它做什么
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.