Say I have string->index pairs of data, e.g.
"hello" -> 0
"best" -> 1
"nice" -> 2
"beautiful" -> 3
Now for my flow I want to have logarithmic search on strings, so it is obvious to place this data into std::map. But, in some point, I want to have back my data ordered by index (as it is written above) but with with no o(N^2) complexity. How I can do that, boost can help? std::map is not useful for the second requirement. How to handle this data without using N – dependent memory. (N is the number of elements in map.)
You need to use
boost::bimap. Check the documentation here.