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映射
基础教程推荐
- 如何定义双括号/双迭代器运算符,类似于向量的向量? 2022-01-01
- 设计字符串本地化的最佳方法 2022-01-01
- C++ 程序在执行 std::string 分配时总是崩溃 2022-01-01
- 什么是T&&(双与号)在 C++11 中是什么意思? 2022-11-04
- 您如何将 CreateThread 用于属于类成员的函数? 2021-01-01
- 运算符重载的基本规则和习语是什么? 2022-10-31
- C++,'if' 表达式中的变量声明 2021-01-01
- 如何在 C++ 中处理或避免堆栈溢出 2022-01-01
- 调用std::Package_TASK::Get_Future()时可能出现争用情况 2022-12-17
- C++ 标准:取消引用 NULL 指针以获取引用? 2021-01-01