免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3887 | 回复: 2
打印 上一主题 下一主题

boost中的哪个容器可以根据多个key进行查找? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-07-03 10:38 |只看该作者 |倒序浏览
我的需求是这样的:
1.   key1,key2,key3可以唯一查找到一条记录
2.   给定了key1或者key2或者key3的值,能够确定是否存在对应的记录

感觉有点像数据库了。。。 不知道这样的要求对boost来说是不是太过分。。。。

感谢回复!

论坛徽章:
0
2 [报告]
发表于 2008-07-03 11:22 |只看该作者
你可以把key1,key2,key3组合成一个可以嘛

论坛徽章:
0
3 [报告]
发表于 2008-07-04 00:17 |只看该作者
LZ可以参考下Boost.MultiIndex
The Boost Multi-index Containers Library provides a class template named multi_index_container which enables the construction of containers maintaining one or more indices with different sorting and access semantics. Indices provide interfaces similar to those of STL containers, making using them familiar. The concept of multi-indexing over the same collection of elements is borrowed from relational database terminology and allows for the specification of complex data structures in the spirit of multiply indexed relational tables where simple sets and maps are not enough. A wide selection of indices is provided, modeled after analogous STL containers like std::set, std::list and hashed sets.

Boost.MultiIndex features additional functionalities, like subobject searching, range querying and in-place updating of elements, which make it a convenient replacement for std::set and set::multiset even when no multi-indexing capabilities are needed.

The versatile nature of Boost.MultiIndex allows for the specification of a wide spectrum of different data structures. The following are possible examples of use developed in the documentation:
+ Sets with several iteration orders and search criteria.
+ Lists with fast lookup and/or without duplicates.
+ Bidirectional maps, i.e. maps searchable either for key or value.
+ MRU (most recently used) lists, structures keeping the n last referenced items, beginning with the newest ones.
+ Emulations of standard containers taking advantage of the extra functionalities provided by Boost.MultiIndex.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP