#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
#include <iostream>
#include <hash_set>
#include <cstdlib>
#include <cstring>
#include <string>
using namespace std; //hash_set常规用法
void main()
{
////哈希表不需要考虑碰撞,查询的效率高,不能有重复的数据
//hash_set<int> myset{ 1,1,1,4,2134,12,34,56,34 };
//myset.insert(26);
//for (auto i : myset)
//{
// cout << i << endl;
//}
////正向迭代
//for (auto ib = myset.begin(), ie = myset.end(); ib != ie; ib++)
//{
// cout << *ib << endl;
//} ////反向迭代
//for (auto rb = myset.rbegin(), re = myset.rend(); rb != re; rb++)
//{
// cout << *rb << endl;
//} ////存储的数据个数
//cout << myset.size() << endl;
////哈希表大小
//cout << myset.bucket_count() << endl; //哈希表不需要考虑碰撞,查询的效率高,不能有重复的数据
hash_set<string> myset{ "microsoft","apple","oracle","tecent" };
myset.insert("huawei");
for (auto i : myset)
{
cout << i << endl;
}
//正向迭代
/*for (auto ib = myset.begin(), ie = myset.end(); ib != ie; ib++)
{
cout << *ib << endl;
}*/ //反向迭代
/*for (auto rb = myset.rbegin(), re = myset.rend(); rb != re; rb++)
{
cout << *rb << endl;
}*/ //存储的数据个数
/*cout << myset.size() << endl;*/
//哈希表大小
/*cout << myset.bucket_count() << endl;*/ auto it = myset.find("apple"); if (it != myset.end())
{
cout << "find" << endl;
cout << *it << endl;
}
else
{
cout << "not find" << endl;
}
cin.get();
}

14.hash_set(已过时,被unorded_set替代)的更多相关文章

  1. .NET 5+ 中已过时的功能

    从 .NET 5 开始,一些新标记为已过时的 API 使用 ObsoleteAttribute 上的两个新属性. ObsoleteAttribute.DiagnosticId 属性指示编译器使用自定义 ...

  2. 解决Maven项目编译时提示:源值1.5已过时,将在未来所有版本中删除

    每次编译项目时,都提示:源值1.5已过时,将在未来所有版本中删除 查了一些资料,发现是因为IDEA默认把项目的源代码版本设置为jdk1.5,目标代码设置为jdk1.5 解决方案:  修改Maven的S ...

  3. 某些输入文件使用或覆盖了已过时的 API

    android出现注: 某些输入文件使用或覆盖了已过时的 API. 注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译. 注: 某些输入文件使用了未经检查或不安全的操作. 注 ...

  4. 【转】android出现注: 某些输入文件使用或覆盖了已过时的 API。 注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。 注: 某些输入文件使用了未经检查或不安全的操作。 注

    使用Android studio打包应用程序出现如下错误: 注: 某些输入文件使用或覆盖了已过时的 API. 注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译. 注: 某些 ...

  5. Android Studio编译OsmAnd出现警告:GeoPointParserUtil.java使用或覆盖了已过时的 API。有关详细信息请使用-Xlint:deprecation重新编译

    [背景] 之前折腾: [记录]Android Studio中导入OsmAnd并编译 期间,遇到了编译警告: 1 2 3 4 5 :OsmAnd-java:compileJava 注: E:\crifa ...

  6. 关于SVN 操作 提示文件已过时,请先update

    提示文件已过时,请先update 错误产生原因:修改文件前没有先update,从svn获取该文件的最新版本. 解决方法:备份你修改后的文件,通过Revert恢复到服务器版本后,再比较之前备份的文件,进 ...

  7. WebMvcConfigurerAdapter已过时

    Spring Boot2.0的版本(创建的时候自动选择的这个版本),然后编译器告诉我WebMvcConfigurerAdapter已过时了 @Deprecated public abstract cl ...

  8. PoI 3.17 已过时代码对比

    PoI 3.17 已过时代码对比颜色定义变化旧版本 : HSSFColor.BLACK.index新版本 : IndexedColors.BLACK.index 获取单元格格式旧版本 : cell.g ...

  9. 使用IDEA运行项目时提示:Warning:java: 源值1.5已过时, 将在未来所有发行版中删除

    如图 在使用IDEA运行项目时,在下方提示:Warning:java: 源值1.5已过时, 将在未来所有发行版中删除 这是因为JDK版本问题 解决方法如下:左上角 file ——> Projec ...

随机推荐

  1. DevExpress TreeList控件的复选框

    作者:jiankunking 出处:http://blog.csdn.net/jiankunking TreeList控件能够同一时候显示树结构和其它数据列,即在一个列上建立父子关系展开或收缩,同一时 ...

  2. Oracle 学习笔记 13 -- 控制用户权限

    数据库控制语言的功能室控制用户对数据库的存取权限. 用户对某类数据具有何种操作权限是有DBA决定的.Oracle 通过GRANT语句完毕权限的授予,通过REVOKE语句完毕对权限的收回. 权限分为系统 ...

  3. python 提取主域名和子域名代码——先根据规则提取,如果有问题,则使用tldextract

    import tldextract def extract_domain(domain): suffix = {'.com','.la','.io', '.co', '.cn','.info', '. ...

  4. xBIM 基础05 3D墙案例

    系列目录    [已更新最新开发文章,点击查看详细]  使用编码的形式去生成一堵墙的模型需要做很多的工作. using System; using System.Collections.Generic ...

  5. 接入gitment为hexo添加评论功能

    title: 接入gitment为hexo添加评论功能 toc: false date: 2018-04-16 10:59:56 categories: methods tags: hexo gitm ...

  6. pip更新问题

    pip更新及Requirement already up-to-date解决方法 pip更新 更新命令 将pip更新版本 1 python -m pip install --upgrade pip R ...

  7. jqGrid的editrules参数

    原文链接:http://blog.csdn.net/mengtianyalll/article/details/13502841 editrules    editrules是用来设置一些可用于可编辑 ...

  8. Android TextView加上阴影效果

    <TextView android:id="@+id/test_shadow" android:layout_width="wrap_content" a ...

  9. 基于localStorage的登录注册

    以下代码,如果有地方有错,请直接指出,我会改进的(只改错误,不改逻辑,因为我自己是不会这样写代码的,这个只适合初学者): <!DOCTYPE html> <html> < ...

  10. 服务器搭建域控与SQL Server的AlwaysOn环境过程(一) 搭建域控服务器

    0 准备阶段 1. Windows Server 服务器 3台(其中域控服务器配置可降低一个水准,目前博主试用的是:域控服务器--2核4G 数据库服务器(节点)--4核8G ) 2. SQL Serv ...