stl中的tuple(tie)
2016-05-19 20:44
323 查看
看的C++标准库(第二版)
书中关于tie()介绍看不懂,不知道这玩意到底能干啥,自己试了一波
tuple <int, float, string> t(55, 22.2, "hello");
int i,i1;
float f,f1;
string s,s1;
make_tuple(ref(i), ref(f), ref(s)) = t;
cout << "i = " << i << endl;
cout << "f = " << f << endl;
cout << "s = " << s << endl;
tie(i1, f1, s1) = t;
cout << "i1 = " << i1 << endl;
cout << "f1 = " << f1 << endl;
cout << "s1 = " << s1 << endl;
这就是说的提取?
书中关于tie()介绍看不懂,不知道这玩意到底能干啥,自己试了一波
tuple <int, float, string> t(55, 22.2, "hello");
int i,i1;
float f,f1;
string s,s1;
make_tuple(ref(i), ref(f), ref(s)) = t;
cout << "i = " << i << endl;
cout << "f = " << f << endl;
cout << "s = " << s << endl;
tie(i1, f1, s1) = t;
cout << "i1 = " << i1 << endl;
cout << "f1 = " << f1 << endl;
cout << "s1 = " << s1 << endl;
这就是说的提取?
相关文章推荐
- nginx 跨域配置
- Android中的通知Notification
- JAVA 大整数类
- jquery动画-animate()
- Multiple dex files define Landroid/support/annotation/AnimRes
- the server ssl certificate failed to verify
- U盘为什么还有剩余空间,但却提示说空间不够
- 集合
- play-maven脚本
- Leetcode 345. Reverse Vowels of a String
- 第十二周周记
- 第11周表格
- 聚类算法(2) ---- DBSCAN
- Android Scroll分析(二)——实现滑动的五种方法
- 【使用Postman测试WEB接口】设置测试环境与全局变量
- 点-圆-圆柱类族的设计
- hdu 1086 You can Solve a Geometry Problem too
- Android中Activity、Service和线程之间的通信
- 《数据挖掘》学习笔记——认识数据(1)
- log4j异常:WARN No appenders could be found for logger