Boost Bimap示例
#include <string>
#include <iostream> #include <boost/bimap.hpp> template< class MapType >
void print_map(const MapType & map,
const std::string & separator,
std::ostream & os )
{
typedef typename MapType::const_iterator const_iterator; for( const_iterator i = map.begin(), iend = map.end(); i != iend; ++i )
{
os << i->first << separator << i->second << std::endl;
}
} int main()
{
// Soccer World cup typedef boost::bimap< std::string, int > results_bimap;
typedef results_bimap::value_type position; results_bimap results;
results.insert( position("Argentina" ,) );
results.insert( position("Spain" ,) );
results.insert( position("Germany" ,) );
results.insert( position("France" ,) ); std::cout << "The number of countries is " << results.size()
<< std::endl; std::cout << "The winner is " << results.right.at()
<< std::endl
<< std::endl; std::cout << "Countries names ordered by their final position:"
<< std::endl; // results.right works like a std::map< int, std::string > print_map( results.right, ") ", std::cout ); std::cout << std::endl
<< "Countries names ordered alphabetically along with"
"their final position:"
<< std::endl; // results.left works like a std::map< std::string, int > print_map( results.left, " ends in position ", std::cout ); return ;
}
Boost Bimap示例的更多相关文章
- boost bimap
The library Boost.Bimap is based on Boost.MultiIndex and provides a container that can be used immed ...
- boost容器bimap简单使用
C++标准提供了map和multi_map,把key映射到value; 但是这种映射是单向的,只能是key到value,不能反过来; boost.bimap扩展了标准库映射型容器,提供双向 ...
- boost开发指南
C++确实很复杂,神一样的0x不知道能否使C++变得纯粹和干爽? boost很复杂,感觉某些地方有过度设计和太过于就事论事的嫌疑,对实际开发工作的考虑太过于理想化.学习boost本身就是一个复杂度,有 ...
- BOOST Voronoi Visualizer
BOOST Voronoi Visualizer eryar@163.com Abstract. The Voronoi extension of the Boost.Polygon library ...
- Boost 1.61.0 Library Documentation
http://www.boost.org/doc/libs/1_61_0/ Boost 1.61.0 Library Documentation Accumulators Framework for ...
- boost 使用列子
#include <boost/lexical_cast.hpp>void test_lexical_cast(){ int number = 123; string str = &quo ...
- boost之数据结构和容器
1.静态数组array,boost对静态数组进行了封装,使用和普通数组一样的初始化式进行初始化. #include <iostream> #include <boost/array. ...
- 1.1. 如何使用XproerUI库
项目类型:MFC XproerUI结构: 3rd 第三方库目录 cximage dll 编译的DLL目录 pug ...
- 如何使用XproerUI库(WTL)-XproerUI界面库教程
版权所有 2009-2015 荆门泽优软件有限公司 保留所有权利 产品首页:http://www.ncmem.com/apps/xproerui/index.asp 开发文档(SkinStudio): ...
随机推荐
- UVALive 7008 Tactical Multiple Defense System
Tactical Multiple Defense System Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld &a ...
- J2EE 课件2
1.JSP页面可由5种元素组合而成: ① 普通的HTML标记符: ② JSP标记,如指令标记.动作标记: ③ 变量和方法的声明: ④ Java程序片: ⑤ Java表达式 2.声明变量和方法 JSP页 ...
- - > 网络流(草地排水)
网络流(Dinic(模板)) Drainage Ditches Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 ...
- iOS消息推送原理和实现总结
一.消息推送原理: 在实现消息推送之前先提及几个于推送相关概念,如下图:1. Provider:就是为指定IOS设备应用程序提供Push的服务器,(如果IOS设备的应用程序是客户端的话,那么Provi ...
- bootstrap日期控件
http://www.bootcss.com/p/bootstrap-datetimepicker/ <link href="js/b/css/bootstrap-datetimepi ...
- 可恢复的安全rm
我们常常使用rm去删除一些文件.假设不小手一抖,那么就悲剧了.你们都懂的... 在经历过一次这种慘剧后.决定永远杜绝这种情况.重写写了shell函数.运行安全的rm.这个函数会把要删除的文件按日期备份 ...
- Java字符编码的转化问题
概述: 我想字符串的编码问题的确会困扰到非常多开发人员.我近期也是被困扰到了. 问题是这种,我们通过二维码扫描来获得二维码中的信息.可是.我们的二维码的产生过程却是"多样化"的.即 ...
- 使用微信JSSDK实现图片上传
近期做的一个项目,刚好用到了JSSDK,把用到的东西整理下. 先附上微信开发人员文档链接:微信开发人员文档 主要用到了: 引入JS文件 在须要调用JS接口的页面引入例如以下JS文件.(支持https) ...
- unity3d杂记
由于公司用unity3d开发客户端部分,今天去参加了下unity3d成都开发者大会.在这里简单记录一下会议里关于unity3d的内容. 说到unity3d,第一次知道的时候也是大概3年前的事情.这几年 ...
- starUML 2.5.1 for mac
http://www.macupdate.com/app/mac/55571/staruml/download 一直在windows下使用 star UML,占用资源少,简洁易用. Mac下也能够用了 ...