C++ equivalent of StringBuffer/StringBuilder?

前端 未结 10 926
说谎
说谎 2020-11-29 15:51

Is there a C++ Standard Template Library class that provides efficient string concatenation functionality, similar to C#\'s StringBuilder or Java\'s StringBuffer?

10条回答
  •  囚心锁ツ
    2020-11-29 16:23

    std::string's += doesn't work with const char* (what stuff like "string to add" appear to be), so definitely using stringstream is the closest to what is required - you just use << instead of +

提交回复
热议问题