How can I increase the performance in a map lookup with key type std::string?

后端 未结 14 1008
天涯浪人
天涯浪人 2021-02-05 23:25

I\'m using a std::map (VC++ implementation) and it\'s a little slow for lookups via the map\'s find method.

The key type is std::string.

14条回答
  •  梦如初夏
    2021-02-06 00:01

    Maybe you could reverse the strings prior to using them as keys in the map? That could help if the first few letters of each string are identical.

提交回复
热议问题