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>**)'
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<…>>
, depends on what you are going to do with it
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.