C ++中映射的多个键 [英] multiple keys for a map in C++

查看:130
本文介绍了C ++中映射的多个键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表,其中的条目是这样

I have a table where the entries are something like this

Row - Column1 - Column2 - Column3 Column4

 1     0X0A      1          2      A
 2     0X0B      2          2      B
 3     0x0C      3          2      C


b $ b

现在我想使用map,使我可以使用列1或列2作为键来获取行。
我应该使用什么样的地图来实现这一点?

Now i want to use map in such that i can use column 1 or Column 2 as the key to get the row. What kind of map i should use to achieve this?

(注意 - 表只是为了解释而不是确切的要求)
使用multimap,但这不会解决问题

(Note- Table is just for explanation and not the exact requirement) I thought of using multimap, but that is not going to solve the prob

推荐答案

尝试多索引容器从 boost

这篇关于C ++中映射的多个键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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