#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. POJ-3264-Balanced Lineup-单点更新

    题目链接:id=3264">http://poj.org/problem? id=3264 这是一个单点更新的模板题,就不详解了,HDU敌兵布阵那题我有详解:链接:http://blo ...

  2. spring web mvc第一天

    spring  web mvc 感觉就是高大上啊!啥都是配置文件就能够了.所以第一步就是弄清楚配置文件使用和总体框架的流程! Spring web mvc最重要的当然是Controller,也就是首先 ...

  3. NOIP2017提高组模拟赛5 (总结)

    NOIP2017提高组模拟赛5 (总结) 第一题 最远 奶牛们想建立一个新的城市.它们想建立一条长度为N (1 <= N <= 1,000,000)的 主线大街,然后建立K条 (2 < ...

  4. 关于Tool接口--------hadoop接口:extends Configured implements Tool 和 ToolRunner.run

    我们在写Hadoop--map/reduce程序时,遇到使用按文件url来分析文件----------多表连接的DistributedCache方式,看不懂使用extends Configured i ...

  5. 【参考】.class文件的JDK编译版本查看

    使用 UltraEdit  打开 .class 文件,第一行内容: 00000000h: CA FE BA BE 00 00 00 32 00 A9 07 00 02 01 00 37 ; 漱壕... ...

  6. 【原创】rman 全库备份脚本

    rman 全库备份脚本 run { allocate channel d1 type disk; allocate channel d2 type disk; backup full database ...

  7. css文字超出变省略号...

    <style>.text1 {    width:200px;    overflow:hidden;    text-overflow:ellipsis;    -o-text-over ...

  8. iF.svnadmin 安装遇到的坑

    iF.svnadmin 官网:http://svnadmin.insanefactory.com/ 安装配置iF.svnadmin : http://blog.linhere.com/archives ...

  9. Vrtualbox虚拟机中共享文件夹配置

    虚拟机装的是ubuntu 16.0.4版本的linux,本机是macOs 10.12.1版本 Vrtualbox进行如下配置 在Vrtualbox-->设置-->共享文件夹-->添加 ...

  10. vue项目input的placeholder根据用户的选择改变

    html部分 <el-input :placeholder="holder" v-model="searchKey"> <el-select ...