Hash Table v/s STL map in C++(C ++中的哈希表v/s STL映射)
问题描述
我正在尝试学习 C++ 映射.只是想知道 STL map 的实现.我读到它采用二叉搜索树.
I am trying to learn C++ maps. Was just wondering about the implementation of STL map. I read it employs Binary search tree.
STL 中是否有哈希表的实现?
Is there a implementation of hash table in STL?
STL map 究竟是如何存储键值对的?
How exactly do STL map stores Key Value pairs?
推荐答案
典型的 STL 实现基于红黑树.C++ TR1 提供使用哈希表实现的 std::tr1::unordered_map.Boost 还提供了一个 unordered_map 哈希表实现.
Typical STL implementations are based on Red-Black trees. C++ TR1 provides std::tr1::unordered_map which uses a hash table implementation. Boost also provides an unordered_map hash table implementation.
C++11 现在有 std::unordered_map
C++11 now has std::unordered_map
这篇关于C ++中的哈希表v/s STL映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:C ++中的哈希表v/s STL映射
基础教程推荐
- CString 到 char* 2021-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 初始化列表*参数*评估顺序 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
