I heard a few people expressing worries about "+" operator in std::string and various workarounds to speed up concatenation. Are any of these really necessary? If so, what is the best way to concatenate strings in C++?
The extra work is probably not worth it, unless you really really need efficiency. You probably will have much better efficiency simply by using operator += instead.
Now after that disclaimer, I will answer your actual question...
The efficiency of the STL string class depends on the implementation of STL you are using.
You could guarantee efficiency and have greater control yourself by doing concatenation manually via c built-in functions.
Why operator+ is not efficient:
Take a look at this interface:
template <class charT, class traits, class Alloc>
basic_string<charT, traits, Alloc>
operator+(const basic_string<charT, traits, Alloc>& s1,
const basic_string<charT, traits, Alloc>& s2)
You can see that a new object is returned after each +. That means that a new buffer is used each time. If you are doing a ton of extra + operations it is not efficient.
Why you can make it more efficient:
Considerations for implementation:
Rope data structure:
If you need really fast concatenations consider using a rope data structure.