如果我尝试将函数声明为void some_function(vector<pair<int, int> > theVector)
,我会收到一个错误(可能来自 " 之后的逗号pair<int
。" 关于如何将这个向量与对传递给函数的任何想法?
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
void someFunc(int x, int y, vector<pair<int, int> > hello);
int main()
{
int x = 0;
int y = 5;
vector<pair<int, int> > helloWorld;
helloWorld.push_back(make_pair(1,2));
someFunc(x,y,helloWorld);
}
void someFunc(int x, int y, vector<pair<int, int> > hello)
{
cout << "I made it." << endl;
}
错误:“向量”尚未声明