std::pair
来源:互联网 发布:nginx mysql 安装 编辑:程序博客网 时间:2024/05/17 22:37
This class couples together a pair of values, which may be of different types (T1 and T2). The individual values can be accessed through its public members first and second.
示例:
#include <utility> // std::pair, std::make_pair#include <string> // std::string#include <iostream> // std::coutint main () { std::pair <std::string,int> planet, homeplanet; planet = std::make_pair("Earth",6371); homeplanet = planet; std::cout << "Home planet: " << homeplanet.first << '\n'; std::cout << "Planet size: " << homeplanet.second << '\n'; return 0;}
Output:
Home planet: Earth
Planet size: 6371
#include <utility> // std::pair#include <iostream> // std::coutint main () { std::pair<int,char> foo (10,'a'); std::pair<int,char> bar (90,'z'); foo.swap(bar); std::cout << "foo contains: " << foo.first; std::cout << " and " << foo.second << '\n'; return 0;}
foo contains: 90 and z
0 0
- std::pair
- std::pair<>
- std::pair 与 std::make_pair
- C++ std::pair, std::tuple
- std::pair 与 std::make_pair
- 扩展std::pair
- C++ std::pair
- C++ std::pair
- C++ std::pair
- (15) C++ std::pair
- C++ STL std::pair
- C++ std::pair<>
- C++ std::pair
- std::pair的使用
- std::pair, std::copy, std::lower_bound, std::back_insert使用
- std::set 和 std::pair 搭配使用
- c++ std::pair 与 std::make
- C++ std::pair 与 std::make_pair
- ios 短信分享没有标题和取消按钮问题
- 刷新tableview上指定的section或cell
- Apache Spark 1.6发布(新特性介绍)
- SSM整合
- STL之智能指针
- std::pair
- Android service
- GPUImage使用
- MAC 查看本机保存的各个密码
- android技术
- <一> 第一个qt+sqlite3程序
- Idea 远程运行Spark程序及 javax.servlet.FilterRegistration 错误解决方法
- 如何测试硬件的稳定性和兼容性
- STL之迭代器实现