双映射结构实现?

发布于 2024-08-24 09:02:44 字数 260 浏览 3 评论 0原文

我正在寻找一个标准的双映射结构 - 是否有在 std/boost/另一个标准 C++ 库中实现的结构?

当我说“双映射”时,我指的是可以通过键和“值”有效索引的映射(它实际上有两种键类型,而不是一种键类型和一种值类型)。

例如:

dualmap<int,string> m;
m[1] = "foo";
m["bar"] = 2
int a = m["bar"]; // a = 2

谢谢, 担

I'm looking for a standard dual-map structure - is there one implemented in std/boost/another standard C++ library?

When I say "dual-map" I mean a map which can be indexed efficiently both by the key and the "value" (it actually has two key types instead of one key type and one value type).

for example:

dualmap<int,string> m;
m[1] = "foo";
m["bar"] = 2
int a = m["bar"]; // a = 2

Thanks,
Dan

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

在风中等你 2024-08-31 09:02:44

如果你不这样做的话,有boost bimap不想要 boost multi index 的所有马力。

There's boost bimap if you don't want all the horsepower of boost multi index.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文