正文
#include <boost/unordered_set.hpp>
小程序:扫一扫查出行
【扫一扫了解最新限行尾号】
复制小程序
【扫一扫了解最新限行尾号】
复制小程序
boost.unordered在C++标准容器std::set,std::multiset,std::map和std::multimap的基础上多实现了四个容器:boost::unordered_set,boost::unordered_multiset,boost::unordered_map和boost::unordered_multimap。那些名字很相似的容器之间并没有什么不同,甚至还提供了相同的接口。在很多情况下,替换这两种容器(std和boost)对你的应用不会造成任何影响。
小结:它里面的库与原有C++标准库中的map、set等相对应,只是内部数据结构改红黑树为hash表来实现,虽然会使得对象的存储空间增大不少,但是查找的平均复杂度却由O(logN)变成O(1),大大提升查找效率。对于需要频繁进行索引查找的应用来说,是极好的选择(当然你还需要考虑效费比,主要是存储空间)。
#include <iostream>
#include <boost/unordered_set.hpp> void main()
{
boost::unordered_set<std::string>myhashset; myhashset.insert("ABC");
myhashset.insert("DEF");
myhashset.insert("GHI"); for (auto ib = myhashset.begin(); ib != myhashset.end(); ib++)
{
std::cout << *ib << std::endl;
} std::cout << (myhashset.find("GHI") != myhashset.end()) << std::endl;//如果查找成功,返回1,否则返回0
}
#include <boost/unordered_set.hpp>的更多相关文章
-
浅谈JSP中include指令与include动作标识的区别
JSP中主要包含三大指令,分别是page,include,taglib.本篇主要提及include指令. include指令使用格式:<%@ include file="文件的绝对路径 ...
-
Entity Framework 6 Recipes 2nd Edition(13-9)译 -> 避免Include
问题 你想不用Include()方法,立即加载一下相关的集合,并想通过EF的CodeFirst方式实现. 解决方案 假设你有一个如Figure 13-14所示的模型: Figure 13-14. A ...
-
error RC1015: cannot open include file 'afxres.h' 解决办法
在为WindowsPhone8程序添加本地化的过程中遇到这个问题: 问题原因就是afxres.h文件缺失,下载它,放到VS安装目录下的VS\include目录下就可以了(选择目录的时候注意对应对版本) ...
-
Mybatis常用总结:参数,返回,执行sql,include等
1.参数注入1.1用#{0},#{1}的形式,0代表第一个参数,1代表第二个参数 public List<RecordVo> queryList(String workerId, Inte ...
-
jsp中的@include与jsp:include区别详解
1 前言 搞java开发的人也许都知道在jsp中引入项目中其他文件有如下两种方式 <%@include file="xxx.jsp"%> <jsp:include ...
-
JSP中编译指令include与动作指令include的区别
include指令是编译阶段的指令,即include所包含的文件的内容是编译的时候插入到JSP文件中,JSP引擎在判断JSP页面未被修改, 否则视为已被修改.由于被包含的文件是在编译时才插入的,因此如 ...
-
C/C++ 中的include
当需要使用已有的方法或库时, 可以将它们的头文件#include进来. #include会在preprocess过程中被替换成它包含的代码. 头文件中包含了需要使用的函数/变量的声明. 当然声明与定义 ...
-
织梦多语言站点,{dede:include filename=''/}引入问题
织梦模板include插入非模板目录文件出现"无法在这个位置找到"错误的解决办法 以下是dede V55_UTF8 查dede include标签手册 (3) include 引入 ...
-
PHP 站点相对包含,路径的问题解决方法(include,require)
以前看了,很多框架,基本上很少使用相对路径包含.而一般很多做php web站点,喜欢用相对路径. 认为这样,无论目录放到那里. 只要跟另外目录关系一致.那么就不会出现问题.如果一个站点,一般都认为,如 ...
-
如何让include标签包裹的布局置于屏幕最下方?
如何让一个Layout 始终在屏幕的下方 我想让<include layout="@layout/bottom" />一直在屏幕下,怎么做? 1.相对布局中用属性 a ...
随机推荐
-
生成excel文件
java操作Excel最常用的开源组件有poi与jxl.jxl是韩国人开发的,发行较早,但是更新的很慢,目前似乎还不支持excel2007.poi是apache下的一个子项目,poi应该是处理ms的o ...
-
UESTC_秋实大哥与快餐店 2015 UESTC Training for Data Structures<Problem C>
C - 秋实大哥与快餐店 Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others) Sub ...
-
UESTC_秋实大哥与花 2015 UESTC Training for Data Structures<Problem B>
B - 秋实大哥与花 Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others) Submi ...
-
二十六、Jcreator使用初步
摘自http://blog.csdn.net/liujun13579/article/details/7751464 二十六.Jcreator使用初步 Jcreator是一个小巧灵活的Java开发工具 ...
-
[破解] DRM-内容数据版权加密保护技术学习(中):License预发放实现
在上一篇文章里实现了对媒体文体的DRM加密,现在一起来实现License的预发放. 所谓预发放就是在播放媒体文件之前先获取到License,License获取成功后,可直接在电脑上进行媒体文件的播放. ...
-
svn之——linux下清除svn的用户名和密码
问题:之前用的svn账号权限不够,需要使用别的账号,所以提出需求——怎么使用新的svn账号进行操作 方法一: linux下删除~/.subversion/auth即可清除之前的用户名和密码:rm -r ...
-
ActionForward
一.只有登录才能显示的页面 这是一个很平常的问题,在访问某些网页的时候,只有登录才可以访问,以此保证安全. 实现原理也很简单,就是将一个属性设置在session中.在访问的时候进行判断即可. 例:re ...
-
Ffmpeg和SDL创建线程(转)
Spawning Threads Overview Last time we added audio support by taking advantage of SDL's audio functi ...
-
.Net语言中关于AOP 的实现详解
来源: IT人家 发布时间: 2011-03-22 20:28 阅读: 3546 次 推荐: 2 原文链接 [收藏] 摘要:该文章主要和大家讲解开发应用系统时在.Net语言中关于AOP ...
-
怎样在 Swift 项目中使用 CocoaPods
4个步骤,将 CocoaPods 导入 Swift 1.创建.编辑 Podfile 文件并 pod install 2.使用 File -> New -> File- 创建一个 Heade ...
JSP中主要包含三大指令,分别是page,include,taglib.本篇主要提及include指令. include指令使用格式:<%@ include file="文件的绝对路径 ...
问题 你想不用Include()方法,立即加载一下相关的集合,并想通过EF的CodeFirst方式实现. 解决方案 假设你有一个如Figure 13-14所示的模型: Figure 13-14. A ...
在为WindowsPhone8程序添加本地化的过程中遇到这个问题: 问题原因就是afxres.h文件缺失,下载它,放到VS安装目录下的VS\include目录下就可以了(选择目录的时候注意对应对版本) ...
1.参数注入1.1用#{0},#{1}的形式,0代表第一个参数,1代表第二个参数 public List<RecordVo> queryList(String workerId, Inte ...
1 前言 搞java开发的人也许都知道在jsp中引入项目中其他文件有如下两种方式 <%@include file="xxx.jsp"%> <jsp:include ...
include指令是编译阶段的指令,即include所包含的文件的内容是编译的时候插入到JSP文件中,JSP引擎在判断JSP页面未被修改, 否则视为已被修改.由于被包含的文件是在编译时才插入的,因此如 ...
当需要使用已有的方法或库时, 可以将它们的头文件#include进来. #include会在preprocess过程中被替换成它包含的代码. 头文件中包含了需要使用的函数/变量的声明. 当然声明与定义 ...
织梦模板include插入非模板目录文件出现"无法在这个位置找到"错误的解决办法 以下是dede V55_UTF8 查dede include标签手册 (3) include 引入 ...
以前看了,很多框架,基本上很少使用相对路径包含.而一般很多做php web站点,喜欢用相对路径. 认为这样,无论目录放到那里. 只要跟另外目录关系一致.那么就不会出现问题.如果一个站点,一般都认为,如 ...
如何让一个Layout 始终在屏幕的下方 我想让<include layout="@layout/bottom" />一直在屏幕下,怎么做? 1.相对布局中用属性 a ...
-
生成excel文件
java操作Excel最常用的开源组件有poi与jxl.jxl是韩国人开发的,发行较早,但是更新的很慢,目前似乎还不支持excel2007.poi是apache下的一个子项目,poi应该是处理ms的o ...
-
UESTC_秋实大哥与快餐店 2015 UESTC Training for Data Structures<Problem C>
C - 秋实大哥与快餐店 Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others) Sub ...
-
UESTC_秋实大哥与花 2015 UESTC Training for Data Structures<Problem B>
B - 秋实大哥与花 Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others) Submi ...
-
二十六、Jcreator使用初步
摘自http://blog.csdn.net/liujun13579/article/details/7751464 二十六.Jcreator使用初步 Jcreator是一个小巧灵活的Java开发工具 ...
-
[破解] DRM-内容数据版权加密保护技术学习(中):License预发放实现
在上一篇文章里实现了对媒体文体的DRM加密,现在一起来实现License的预发放. 所谓预发放就是在播放媒体文件之前先获取到License,License获取成功后,可直接在电脑上进行媒体文件的播放. ...
-
svn之——linux下清除svn的用户名和密码
问题:之前用的svn账号权限不够,需要使用别的账号,所以提出需求——怎么使用新的svn账号进行操作 方法一: linux下删除~/.subversion/auth即可清除之前的用户名和密码:rm -r ...
-
ActionForward
一.只有登录才能显示的页面 这是一个很平常的问题,在访问某些网页的时候,只有登录才可以访问,以此保证安全. 实现原理也很简单,就是将一个属性设置在session中.在访问的时候进行判断即可. 例:re ...
-
Ffmpeg和SDL创建线程(转)
Spawning Threads Overview Last time we added audio support by taking advantage of SDL's audio functi ...
-
.Net语言中关于AOP 的实现详解
来源: IT人家 发布时间: 2011-03-22 20:28 阅读: 3546 次 推荐: 2 原文链接 [收藏] 摘要:该文章主要和大家讲解开发应用系统时在.Net语言中关于AOP ...
-
怎样在 Swift 项目中使用 CocoaPods
4个步骤,将 CocoaPods 导入 Swift 1.创建.编辑 Podfile 文件并 pod install 2.使用 File -> New -> File- 创建一个 Heade ...