为什么没有提高::侵入::地图? [英] Why isn't there boost::intrusive::map?

查看:184
本文介绍了为什么没有提高::侵入::地图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

升压文档( HTTP://www.boost。组织/ DOC /库/ 1_55_0 / DOC / HTML / intrusive.html )指出,介入式容器是为列表实施(单/双链接) 设置多集
我无法找到地图上的实现。是否有任何更深层次的原因,还是它只是在等待被执行?

The boost documentation (http://www.boost.org/doc/libs/1_55_0/doc/html/intrusive.html) states that the intrusive containers are implemented for list (both single/double linked), set and multiset. I couldn't find an implementation for the map. Is there any deeper reason for it, or is it just waiting to be implemented?

推荐答案

这是因为地图<关键字,值> 实际上设置<性病::对<关键常量,价值与GT;> 和Boost.Intrusive和Boost.MultiIndex的设置允许您使用值的成员作为重点之一。换句话说,没有必要为地图如果找到可以接受一个比较关键,而不是整个价值搜索这一直是一个长期没有解决的问题与的std ::地图的std ::设置

This is because a map<Key, Value> is actually set<std::pair<Key const, Value>> and Boost.Intrusive and Boost.MultiIndex sets allow you to use one of the value members as a key. In other words, there is no need for map if find can accept a comparable key, rather than the entire value to search for which has been a long-standing unresolved issue with std::map and std::set:

关联容器查找功能(查找,LOWER_BOUND,UPPER_BOUND,
  equal_range)只需要为key_type的参数,需要用户构建
  (隐式或显式)的为key_type的一个目的是执行查找。
  这可能是昂贵的,例如构建一个大对象在一组搜索
  当比较器功能只着眼于对象中的一个字段。那里
  在用户的强烈愿望能够使用其他类型的搜索哪些
  是与为key_type可比

The associative container lookup functions (find, lower_bound, upper_bound, equal_range) only take an argument of key_type, requiring users to construct (either implicitly or explicitly) an object of the key_type to do the lookup. This may be expensive, e.g. constructing a large object to search in a set when the comparator function only looks at one field of the object. There is strong desire among users to be able to search using other types which are comparable with the key_type.

这篇关于为什么没有提高::侵入::地图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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