首页 > 其他分享 >make_pair 简单使用

make_pair 简单使用

时间:2022-12-29 16:03:52浏览次数:31  
标签:std cout auto make 简单 pair main


code :

#include <iostream>
using namespace std;

int main()
{
auto pair_1 =make_pair(1,"2");
cout << pair_1.first << endl;
cout << pair_1.second << endl;
auto pair_2 = make_pair(2, "1");
pair_1.swap(pair_2); //交换
cout << pair_1.first << endl;
cout << pair_1.second << endl;
cout << pair_2.first << endl;
cout << pair_2.second << endl;
}

运行结果:

make_pair 简单使用_#include

标签:std,cout,auto,make,简单,pair,main
From: https://blog.51cto.com/u_15906863/5978177

相关文章