pair:成对出现的一组数据
pair中第一个元素为key(键值),起索引作用,第二个元素为value(实值)
pair对组的创建
#include <iostream>
using namespace std;
void printset(const set<int>& l)
{
for (set<int>::const_iterator it = l.begin(); it != l.end(); it++)
{
cout << *it << endl;
}
}
//pair对组的创建
void test1()
{
//第一种方式
pair<string, int>p("tom", 20);
//第二种
pair<string, int>p2 = make_pair("jerry", 30);
}