2 ms·
std::string's small string optimization is automatic, you don't have to do anything with it or about it. Bigger strings create allocations, small ones don't, a
by CyberDildonics 12y ago
std::string's small string optimization is automatic, you don't have to do anything with it or about it. Bigger strings create allocations, small ones don't, and statistically most strings are small. Also if you use const references you can be sure that you aren't modifying the strings and aren't copying them. With C++11 you can move strings and so the ownership is explicit.