Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dual map structure implementation?

Tags:

c++

std

map

boost

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

like image 496
Danra Avatar asked Dec 02 '22 06:12

Danra


1 Answers

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

like image 125
piotr Avatar answered Dec 19 '22 01:12

piotr