在unordered_map中查找值 [英] Finding value in unordered_map

查看:1833
本文介绍了在unordered_map中查找值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Boost unordered_map。我有一个键值对每个条目。如何确定地图中是否存在特定值? (我不想创建另一个unordered_map,它将值作为键和值存储为值)

I am using Boost unordered_map. I have a key value pair for each entry. How could I determine whether a particular value exist in the map? (I don't want to create another unordered_map which stored the value as key and key as value)

谢谢。

推荐答案

Boost拥有 Bimap ,它是一个双向映射(即,键和值都指向彼此)。这听起来更适合你的需要比 unordered_map

Boost has the Bimap, which is a bidirectional map (ie, keys and values both refer to each other). This sounds more appropriate for your needs than the unordered_map.

这篇关于在unordered_map中查找值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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