std :: map - 里面有什么数据结构 [英] std::map -- what data structure is inside

查看:340
本文介绍了std :: map - 里面有什么数据结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是初学者和学习C ++
很难理解std :: map的概念,因为我玩的代码意味着 map 是一个搜索树,即std :: map对象的所有名称都有* tree以及注释。

I'm beginner and learning C++ Having hard times to understand std::map concepts, because the code I'm playing with implies that the map is a search tree, i.e. all the names of std::map objects have *tree in it as well as comments.

但是在阅读这个资料后, http://www.cprogramming.com/tutorial/stl/stlmap.html 我倾向于认为std :: map与tree或hash无关。

However after reading this material http://www.cprogramming.com/tutorial/stl/stlmap.html I tend to think that std::map has nothing to do with tree or hash.

所以我很困惑 - 代码中的变量和注释都在我身上,比较复杂,我认为是:)

So I`m confused -- either the variables and comment in the code lie to me, or the subject is more complex then I think it is :)

推荐答案

std :: map 是关联容器。标准唯一的要求是容器必须具有关联容器接口和行为,实现未定义。虽然实现符合复杂性和接口请求,但是是有效的实现。

std::map is an associative container. The only requeriment by the standard is that the container must have an associative container interface and behaviour, the implementation is not defined. While the implemetation fits the ccomplexity and interface requeriments, is a valid implementation.

另一方面, std :: map 通常使用红黑树,作为引用说。

On the other hand, std::map is usually implemented with a red-black tree, as the reference says.

这篇关于std :: map - 里面有什么数据结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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