Optimize string concatenation
Co-authored-by: Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com>
This commit is contained in:
parent
703d863a48
commit
8272cd9dec
|
@ -756,7 +756,9 @@ inline std::string operator + (std::string && s, std::string_view s2)
|
||||||
|
|
||||||
inline std::string operator + (std::string_view s1, const char * s2)
|
inline std::string operator + (std::string_view s1, const char * s2)
|
||||||
{
|
{
|
||||||
std::string s(s1);
|
std::string s;
|
||||||
|
s.reserve(s1.size() + strlen(s2));
|
||||||
|
s.append(s1);
|
||||||
s.append(s2);
|
s.append(s2);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue