How efficient is std::string compared to null-terminated strings?

前端 未结 14 2097
心在旅途
心在旅途 2020-12-28 19:23

I\'ve discovered that std::strings are very slow compared to old-fashioned null-terminated strings, so much slow that they significantly slow down my overall pr

14条回答
  •  粉色の甜心
    2020-12-28 19:59

    If you have an indication of the eventual size of your vector you can prevent excessive resizes by calling reserve() before filling it up.

提交回复
热议问题