Say there is a map: typedef map<int, string> MyMap;
I'd like to traverse it by the string, for example:
3 -> a
1 -> b
7 -> b
2 -> c
One way is to sort this map by its value. But I'm afraid this will have impact to find() efficiency (is it true?)
Another choice is to use boost::bimap
. But, as you might notice, the value in MyMap is not unique, so bimap is not applicable here.
Is there a good way to do it?