Article directory
1. Definition and initialization
pair<type1, type2> p;
// 初始化方法有3种
pair<int, string> p = make_pair(1, "one");
pair<int, string> p = {
1, "one"};
pair<int, string> p(1, "one");
2. How to use
- There are two member variables, p.first/p.second represent key and value respectively
- If the function has a return value
Same type, you can use array {}
different types, you can pair