Regarding STL Maps

Hi,
I am developing a program where i have a map of very large size where the key value is a string.... I now have a string ....is there a way to directly search the key value so that the searching becomes faster in map.. rather than using find and compare which will be slower since the size of map is large...
I tried to find it in the reference section but could not find it ... i tried to this using key_comp object of map.... but it doesnt return whether the key value is equal or not.... more over i m comparing strings as key values here...

Thanks in Advance
Herat
No. If you want some other criteria to improve search times, you must add it to the key and provide a comparison function (less predicate).
What exactly are you trying to do?

Are you trying to look up in a map by value instead of by key?

If so, then I'd point you at boost::multi_index_container (www.boost.org).
It will give you O(log n) lookups on both key and value.
if your key itself is string you can't get it better. Map is already a BST. If you are looking something real fast, use sorted vectors (because you said you have large size tree). thats best you can do.
~Vimal
Do you have access to TR1 unordered containers?
Topic archived. No new replies allowed.