C++11 unordered_set
来源:互联网 发布:ghost最新软件版本 编辑:程序博客网 时间:2024/06/05 11:19
template < class Key, // unordered_set::key_type/value_type class Hash = hash<Key>, // unordered_set::hasher class Pred = equal_to<Key>, // unordered_set::key_equal class Alloc = allocator<Key> // unordered_set::allocator_type > class unordered_set;
C++ 11中对unordered_set描述大体如下:无序集合容器(unordered_set)是一个存储唯一(unique,即无重复)的关联容器(Associative container),容器中的元素无特别的秩序关系,该容器允许基于值的快速元素检索,同时也支持正向迭代。
在一个unordered_set内部,元素不会按任何顺序排序,而是通过元素值的hash值将元素分组放置到各个槽(Bucker,也可以译为“桶”),这样就能通过元素值快速访问各个对应的元素(均摊耗时为O(1))。
原型中的Key代表要存储的类型,而hash也就是你的hash函数,equal_to用来判断两个元素是否相等,allocator是内存的分配策略。一般情况下,我们只关心hash和equal_to参数,下面将介绍这两部分。
参考:
http://www.cplusplus.com/reference/unordered_set/unordered_set/
http://blog.csdn.net/dream_you_to_life/article/details/46785741
阅读全文
0 0
- 【c++】unordered_set和unordered_map
- C++11 unordered_set
- 【C++】boost库中的unordered_map和unordered_set
- 【C++】unordered_map,unordered_set,map和set的用法和区别
- C++ STL——hash/unordered_set/c++11关键字decltype
- boost::unordered_set
- unordered_set介绍
- unordered_set笔记
- 【C++】【总结】unordered_map,unordered_set,map和set的用法和区别
- 8.Boost之unordered_set
- unordered_set的count函数
- unordered_set VS set
- STL unordered_set(hahs_set)详解
- C++的<unordered_set>
- STL---unordered_set---学习
- boost之unordered_set
- C++ set和unordered_set
- 简单使用set/unordered_set (备忘)
- C#(1)-------发布
- live555 rtsp rtp学习笔记
- ubuntu下CUDA安装绕坑
- PAT 1078. Hashing (25)
- 谷歌宣布Kotlin成安卓开发一级语言,我们如何来学习它
- C++11 unordered_set
- js全选功能的实现
- No consensus in exactly-once
- IntelliJ IDEA 设置 自己的live template(设置自定义方法模板)
- 5.SpringMVC_使用POJO作为参数,使用Servlet原生API作为参数
- k近邻(KNN)的Python实现
- DCMTK in VS2015
- 我的博客开篇
- Win8(10)搭建FTP环境+防火墙配置