C ++中的哈希表v/s STL映射 [英] Hash Table v/s STL map in C++

查看:18
本文介绍了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.

  1. STL 中是否有哈希表的实现?

  1. 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映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆