# include <iostream>
# include <vector>
using namespace std;
int main()
{
vector<pair<int, int>> v1;
v1.emplace_back(1, 1);
auto it = v1.begin();
cout<<it -> first;
return 0;
}
迭代器类型的it
# include <iostream>
# include <vector>
using namespace std;
int main()
{
vector<pair<int, int>> v1;
v1.emplace_back(1, 1);
for(vector<pair<int, int>>::iterator it = v1.begin(); it != v1.end(); it++)
{
cout<<it -> second;
}
return 0;
}
无嵌套的pair
# include <iostream>
# include <vector>
using namespace std;
int main()
{
auto it = make_pair(1, 1);
cout<<it.second;
return 0;
}